mirror of https://github.com/daffainfo/nuclei.git
Fixed some edge cases with status codes in redirect chains
parent
a9f586369a
commit
9b364080ea
|
@ -11,8 +11,13 @@ requests:
|
|||
- "{{BaseURL}}"
|
||||
redirects: true
|
||||
max-redirects: 3
|
||||
matchers-condition: and
|
||||
matchers:
|
||||
- type: word
|
||||
part: header
|
||||
words:
|
||||
- "TestRedirectHeaderMatch"
|
||||
- "TestRedirectHeaderMatch"
|
||||
|
||||
- type: status
|
||||
status:
|
||||
- 302
|
|
@ -51,5 +51,5 @@ func main() {
|
|||
}
|
||||
|
||||
func errIncorrectResultsCount(results []string) error {
|
||||
return fmt.Errorf("incorrect number of results %s", strings.Join(results, "\n\t"))
|
||||
return fmt.Errorf("incorrect number of results \n\t%s", strings.Join(results, "\n\t"))
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@ func (request *Request) executeRequest(reqURL string, generatedRequest *generate
|
|||
}
|
||||
finalEvent := make(output.InternalEvent)
|
||||
|
||||
outputEvent := request.responseToDSLMap(resp, reqURL, matchedURL, tostring.UnsafeToString(dumpedRequest), tostring.UnsafeToString(response.fullResponse), tostring.UnsafeToString(response.body), tostring.UnsafeToString(response.headers), duration, generatedRequest.meta)
|
||||
outputEvent := request.responseToDSLMap(response.resp, reqURL, matchedURL, tostring.UnsafeToString(dumpedRequest), tostring.UnsafeToString(response.fullResponse), tostring.UnsafeToString(response.body), tostring.UnsafeToString(response.headers), duration, generatedRequest.meta)
|
||||
if i := strings.LastIndex(hostname, ":"); i != -1 {
|
||||
hostname = hostname[:i]
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ type redirectedResponse struct {
|
|||
headers []byte
|
||||
body []byte
|
||||
fullResponse []byte
|
||||
resp *http.Response
|
||||
}
|
||||
|
||||
// dumpResponseWithRedirectChain dumps a http response with the
|
||||
|
@ -41,6 +42,7 @@ func dumpResponseWithRedirectChain(resp *http.Response, body []byte) ([]redirect
|
|||
respObj := redirectedResponse{
|
||||
headers: respData,
|
||||
body: body,
|
||||
resp: resp,
|
||||
fullResponse: bytes.Join([][]byte{respData, body}, []byte{}),
|
||||
}
|
||||
if err := normalizeResponseBody(resp, &respObj); err != nil {
|
||||
|
@ -65,6 +67,7 @@ func dumpResponseWithRedirectChain(resp *http.Response, body []byte) ([]redirect
|
|||
respObj := redirectedResponse{
|
||||
headers: respData,
|
||||
body: body,
|
||||
resp: redirectResp,
|
||||
fullResponse: bytes.Join([][]byte{respData, body}, []byte{}),
|
||||
}
|
||||
if err := normalizeResponseBody(redirectResp, &respObj); err != nil {
|
||||
|
|
Loading…
Reference in New Issue