diff --git a/cmd/commons/core/runner.go b/cmd/commons/core/runner.go index ebc559a..22f016d 100644 --- a/cmd/commons/core/runner.go +++ b/cmd/commons/core/runner.go @@ -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 { diff --git a/cmd/commons/poc/IsAliveUrl.go b/cmd/commons/poc/IsAliveUrl.go index 85a62ad..e38ae29 100644 --- a/cmd/commons/poc/IsAliveUrl.go +++ b/cmd/commons/poc/IsAliveUrl.go @@ -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) + } } @@ -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 } diff --git a/go.mod b/go.mod index af8b4b4..bddbf5b 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 2f016d6..3343eca 100644 --- a/go.sum +++ b/go.sum @@ -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=