rule.Search 正则匹配范围从body改成header+body

This commit is contained in:
影舞者 2022-07-11 16:50:32 +08:00
parent ed96a8dd89
commit 023fa19a48

View File

@ -145,7 +145,7 @@ func executePoc(oReq *http.Request, p *Poc) (bool, error, string) {
variableMap["response"] = resp
// 先判断响应页面是否匹配search规则
if rule.Search != "" {
result := doSearch(strings.TrimSpace(rule.Search), string(resp.Body))
result := doSearch(strings.TrimSpace(rule.Search), GetHeader(resp.Headers)+string(resp.Body))
if result != nil && len(result) > 0 { // 正则匹配成功
for k, v := range result {
variableMap[k] = v
@ -435,7 +435,7 @@ func clustersend(oReq *http.Request, variableMap map[string]interface{}, req *Re
variableMap["response"] = resp
// 先判断响应页面是否匹配search规则
if rule.Search != "" {
result := doSearch(strings.TrimSpace(rule.Search), string(resp.Body))
result := doSearch(strings.TrimSpace(rule.Search), GetHeader(resp.Headers)+string(resp.Body))
if result != nil && len(result) > 0 { // 正则匹配成功
for k, v := range result {
variableMap[k] = v
@ -514,3 +514,12 @@ func CheckInfoPoc(infostr string) string {
}
return ""
}
func GetHeader(header map[string]string) (output string) {
for name, values := range header {
line := fmt.Sprintf("%s: %s\n", name, values)
output = output + line
}
output = output + "\r\n"
return
}