Skip to content

Commit

Permalink
🐛 fix IsAliveUrl bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SummerSec committed Jun 14, 2022
1 parent 2097cb8 commit 24844a4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
10 changes: 5 additions & 5 deletions cmd/commons/core/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ func Start2(u string, hashmap map[string]interface{}) {
//for k, v := range hashmap {
// log.Debugln("key: ", k, " value: ", v)
//}
defer func() {
if errs := recover(); errs != nil {
log.Debug(errs)
}
}()
//defer func() {
// if errs := recover(); errs != nil {
// log.Debug(errs)
// }
//}()

r, err := url.Parse(u)
if err != nil {
Expand Down
31 changes: 16 additions & 15 deletions cmd/commons/poc/IsAliveUrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ import (
type IsAliveUrl struct{}

func (t IsAliveUrl) SendPoc(target string, hashmap map[string]interface{}) {
//reqmap := req2.NewReqInfoToMap(hashmap)
//reqmap["url"] = target
//reqmap["method"] = "HEAD"
//reqmap["timeout"] = "3"
//headers := map[string]string{
// "User-Agent": utils.GetUA(),
//}
//reqmap["headers"] = headers
//resp := utils.Send(reqmap)
//if t.CheckExp(resp,target,hashmap) {
// log.Infof("[+] %s is alive", target)
//}
reqmap := req2.NewReqInfoToMap(hashmap)
reqmap["url"] = target
reqmap["method"] = "HEAD"
headers := map[string]string{
"User-Agent": utils.GetUA(),
}
reqmap["headers"] = headers
resp := utils.Send(reqmap)
if t.CheckExp(resp, target, hashmap) {
log.Infof("[+] %s is alive", target)
}

}

Expand All @@ -39,9 +38,11 @@ func (t IsAliveUrl) CheckExp(resp *req.Response, target string, hashmap map[stri
}
reqmap["headers"] = headers
resp2 := utils.Send(reqmap)
log.Debug(resp2.Dump())
if resp2.Dump() == "" {
return false
intcode := resp2.GetStatusCode()
log.Debugf(" %d ", intcode)

if intcode >= 0 {
return true
}
return true
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.13
require (
github.com/corpix/uarand v0.1.1
github.com/fatih/structs v1.1.0
github.com/imroc/req/v3 v3.11.2
github.com/imroc/req/v3 v3.13.1
github.com/projectdiscovery/mapcidr v0.0.9
github.com/sirupsen/logrus v1.8.1
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imroc/req/v3 v3.11.2 h1:21T0t1sZTJ04e0tMOEMmH3z66V3opRH8LO5lss3Sv3c=
github.com/imroc/req/v3 v3.11.2/go.mod h1:G6fkq27P+JcTcgRVxecxY+amHN1xFl8W81eLCfJ151M=
github.com/imroc/req/v3 v3.13.1 h1:kgqEyBkuZQ4Fbv5M2sC0v6Sov9Ne4JurYmziRphvpHU=
github.com/imroc/req/v3 v3.13.1/go.mod h1:G6fkq27P+JcTcgRVxecxY+amHN1xFl8W81eLCfJ151M=
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand Down

0 comments on commit 24844a4

Please sign in to comment.