Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ddf75df

Browse files
committedMay 6, 2022
ip段的处理
1 parent a9ff698 commit ddf75df

File tree

8 files changed

+61
-52
lines changed

8 files changed

+61
-52
lines changed
 

‎cmd/commons/attack/attack.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func attack(url string, pocs map[string]interface{}, hashmap map[string]interfac
4949
log.Debugf("[*] 分割字符串 %s", v)
5050
ps = append(ps, v)
5151
}
52-
5352
// 如果没有选定字符串 则默认所有pocs
5453
if len(ps) == 0 {
5554
log.Debugln("[*] attack all pocs")

‎cmd/commons/core/runner.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (r *Runner) Run() {
3939
} else if r.options.File != "" {
4040
urls, _ = utils.ReadFile(r.options.File)
4141
} else if r.options.IP != "" {
42-
urls = append(urls, r.options.IP)
42+
urls = utils.GetIPToUrlsLinks(r.options.IP, urls)
4343
} else {
4444
log.Error("No file or url or ips specified")
4545
return
@@ -81,7 +81,12 @@ func Start(u string, hashmap map[string]interface{}, i int, c chan int) {
8181
log.Errorln(err)
8282
return
8383
}
84-
target := r.Scheme + "://" + r.Host + r.Path
84+
var target string
85+
if r.Path == "" {
86+
target = r.Scheme + "://" + r.Host + "/"
87+
} else {
88+
target = r.Scheme + "://" + r.Host + r.Path
89+
}
8590

8691
attack.Sevice(target, hashmap)
8792

‎cmd/commons/utils/ips.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package utils
2+
3+
import "github.com/projectdiscovery/mapcidr"
4+
5+
func GetIPToUrlsLinks(ip string, urls []string) []string {
6+
7+
subnets, _ := mapcidr.IPAddresses(ip)
8+
for _, subnet := range subnets {
9+
link := "http://" + subnet + "/"
10+
urls = append(urls, link)
11+
}
12+
return urls
13+
}

‎cmd/test/Strings.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"fmt"
55
"github.com/SummerSec/SpringExploit/cmd/commons/utils"
6+
"strings"
67
)
78

89
func main() {
@@ -24,4 +25,8 @@ func main() {
2425
c := fmt.Sprintf(b, "qaz", "qwe")
2526
fmt.Println(c)
2627

28+
d := ""
29+
ds := strings.Split(d, ",")
30+
fmt.Println(ds)
31+
2732
}

‎cmd/test/ip.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
package main
2+
3+
import "github.com/projectdiscovery/mapcidr"
4+
5+
func main() {
6+
ip := "192.168.1.2/32"
7+
subnets, _ := mapcidr.IPAddresses(ip)
8+
9+
for _, subnet := range subnets {
10+
println("http://" + subnet)
11+
}
12+
}

‎cmd/test/url.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@ package main
22

33
import (
44
"fmt"
5-
"github.com/imroc/req/v3"
5+
"net/url"
6+
"strings"
67
)
78

89
func main() {
9-
u := "https://sumsec.me/ads.txt"
10-
c := req.C()
11-
resp, _ := c.R().EnableDump().Get(u)
12-
s := resp.Dump()
13-
fmt.Println("--->" + s)
10+
u := "https://sumsec.me/"
11+
//c := req.C()
12+
//resp, _ := c.R().EnableDump().Get(u)
13+
//s := resp.Dump()
14+
//fmt.Println("--->" + s)
15+
16+
r, _ := url.Parse(u)
17+
fmt.Println(r.Scheme + "://" + r.Host + r.Path)
18+
d := ""
19+
ds := strings.Split(d, ",")
20+
fmt.Println(ds)
21+
1422
}

‎go.mod

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
module github.com/SummerSec/SpringExploit
22

3-
go 1.13
3+
go 1.17
44

55
require (
66
github.com/corpix/uarand v0.1.1
77
github.com/fatih/structs v1.1.0
8-
github.com/imroc/req/v3 v3.10.0
8+
github.com/imroc/req/v3 v3.11.0
9+
github.com/projectdiscovery/mapcidr v0.0.9
910
github.com/sirupsen/logrus v1.8.1
1011
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
1112

1213
)
14+
15+
require (
16+
github.com/hashicorp/errwrap v1.0.0 // indirect
17+
github.com/hashicorp/go-multierror v1.1.1 // indirect
18+
github.com/projectdiscovery/blackrock v0.0.0-20210415162320-b38689ae3a2e // indirect
19+
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 // indirect
20+
golang.org/x/text v0.3.7 // indirect
21+
)

‎go.sum

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.