减少info结构体大小

This commit is contained in:
影舞者
2022-07-03 23:41:39 +08:00
parent 8e1db5995e
commit b9b5eb9ce4
24 changed files with 119 additions and 122 deletions
+2 -1
View File
@@ -77,6 +77,7 @@ func executePoc(oReq *http.Request, p *Poc) (bool, error, string) {
return false, err, ""
}
variableMap := make(map[string]interface{})
defer func() { variableMap = nil }()
variableMap["request"] = req
for _, item := range p.Set {
k, expression := item.Key, item.Value
@@ -123,7 +124,7 @@ func executePoc(oReq *http.Request, p *Poc) (bool, error, string) {
req.Url.Path = rule.Path
}
// 某些poc没有区分path和query,需要处理
//req.Url.Path = strings.ReplaceAll(req.Url.Path, " ", "%20")
req.Url.Path = strings.ReplaceAll(req.Url.Path, " ", "%20")
//req.Url.Path = strings.ReplaceAll(req.Url.Path, "+", "%20")
newRequest, err := http.NewRequest(rule.Method, fmt.Sprintf("%s://%s%s", req.Url.Scheme, req.Url.Host, string([]rune(req.Url.Path))), strings.NewReader(rule.Body))
+3 -3
View File
@@ -23,7 +23,7 @@ var (
func Inithttp(PocInfo common.PocInfo) {
//PocInfo.Proxy = "http://127.0.0.1:8080"
err := InitHttpClient(PocInfo.Num, PocInfo.Proxy, time.Duration(PocInfo.Timeout)*time.Second)
err := InitHttpClient(PocInfo.Num, common.Proxy, time.Duration(common.WebTimeout)*time.Second)
if err != nil {
log.Fatal(err)
}
@@ -57,7 +57,7 @@ func InitHttpClient(ThreadsNum int, DownProxy string, Timeout time.Duration) err
} else {
return errors.New("Failed type assertion to DialContext")
}
}else if DownProxy != "" {
} else if DownProxy != "" {
if DownProxy == "1" {
DownProxy = "http://127.0.0.1:8080"
} else if DownProxy == "2" {
@@ -65,7 +65,7 @@ func InitHttpClient(ThreadsNum int, DownProxy string, Timeout time.Duration) err
} else if !strings.Contains(DownProxy, "://") {
DownProxy = "http://127.0.0.1:" + DownProxy
}
if !strings.HasPrefix(DownProxy,"socks") && !strings.HasPrefix(DownProxy,"http") {
if !strings.HasPrefix(DownProxy, "socks") && !strings.HasPrefix(DownProxy, "http") {
return errors.New("no support this proxy")
}
u, err := url.Parse(DownProxy)
+2 -2
View File
@@ -599,13 +599,13 @@ func DoRequest(req *http.Request, redirect bool) (*Response, error) {
oResp, err = ClientNoRedirect.Do(req)
}
if err != nil {
fmt.Println(err)
//fmt.Println("[-]DoRequest error: ",err)
return nil, err
}
defer oResp.Body.Close()
resp, err := ParseResponse(oResp)
if err != nil {
fmt.Println(err)
fmt.Println("[-]ParseResponse error: ", err)
return nil, err
}
return resp, err