Skip to content

Commit 24844a4

Browse files
committed
🐛 fix IsAliveUrl bug
1 parent 2097cb8 commit 24844a4

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

cmd/commons/core/runner.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,11 @@ func Start2(u string, hashmap map[string]interface{}) {
170170
//for k, v := range hashmap {
171171
// log.Debugln("key: ", k, " value: ", v)
172172
//}
173-
defer func() {
174-
if errs := recover(); errs != nil {
175-
log.Debug(errs)
176-
}
177-
}()
173+
//defer func() {
174+
// if errs := recover(); errs != nil {
175+
// log.Debug(errs)
176+
// }
177+
//}()
178178

179179
r, err := url.Parse(u)
180180
if err != nil {

cmd/commons/poc/IsAliveUrl.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ import (
1010
type IsAliveUrl struct{}
1111

1212
func (t IsAliveUrl) SendPoc(target string, hashmap map[string]interface{}) {
13-
//reqmap := req2.NewReqInfoToMap(hashmap)
14-
//reqmap["url"] = target
15-
//reqmap["method"] = "HEAD"
16-
//reqmap["timeout"] = "3"
17-
//headers := map[string]string{
18-
// "User-Agent": utils.GetUA(),
19-
//}
20-
//reqmap["headers"] = headers
21-
//resp := utils.Send(reqmap)
22-
//if t.CheckExp(resp,target,hashmap) {
23-
// log.Infof("[+] %s is alive", target)
24-
//}
13+
reqmap := req2.NewReqInfoToMap(hashmap)
14+
reqmap["url"] = target
15+
reqmap["method"] = "HEAD"
16+
headers := map[string]string{
17+
"User-Agent": utils.GetUA(),
18+
}
19+
reqmap["headers"] = headers
20+
resp := utils.Send(reqmap)
21+
if t.CheckExp(resp, target, hashmap) {
22+
log.Infof("[+] %s is alive", target)
23+
}
2524

2625
}
2726

@@ -39,9 +38,11 @@ func (t IsAliveUrl) CheckExp(resp *req.Response, target string, hashmap map[stri
3938
}
4039
reqmap["headers"] = headers
4140
resp2 := utils.Send(reqmap)
42-
log.Debug(resp2.Dump())
43-
if resp2.Dump() == "" {
44-
return false
41+
intcode := resp2.GetStatusCode()
42+
log.Debugf(" %d ", intcode)
43+
44+
if intcode >= 0 {
45+
return true
4546
}
4647
return true
4748
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.13
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.11.2
8+
github.com/imroc/req/v3 v3.13.1
99
github.com/projectdiscovery/mapcidr v0.0.9
1010
github.com/sirupsen/logrus v1.8.1
1111
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
3838
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
3939
github.com/imroc/req/v3 v3.11.2 h1:21T0t1sZTJ04e0tMOEMmH3z66V3opRH8LO5lss3Sv3c=
4040
github.com/imroc/req/v3 v3.11.2/go.mod h1:G6fkq27P+JcTcgRVxecxY+amHN1xFl8W81eLCfJ151M=
41+
github.com/imroc/req/v3 v3.13.1 h1:kgqEyBkuZQ4Fbv5M2sC0v6Sov9Ne4JurYmziRphvpHU=
42+
github.com/imroc/req/v3 v3.13.1/go.mod h1:G6fkq27P+JcTcgRVxecxY+amHN1xFl8W81eLCfJ151M=
4143
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
4244
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
4345
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=

0 commit comments

Comments
 (0)