mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 04:55:28 +00:00
Merge pull request #1688 from projectdiscovery/issue-1214-truncated-resp
Adding truncation info on debug
This commit is contained in:
commit
80e969f917
@ -564,7 +564,8 @@ func (request *Request) executeRequest(reqURL string, generatedRequest *generate
|
||||
}
|
||||
|
||||
responseContentType := resp.Header.Get("Content-Type")
|
||||
dumpResponse(event, request.options, response.fullResponse, formedURL, responseContentType)
|
||||
isResponseTruncated := len(gotData) >= request.MaxSize
|
||||
dumpResponse(event, request.options, response.fullResponse, formedURL, responseContentType, isResponseTruncated)
|
||||
|
||||
callback(event)
|
||||
}
|
||||
@ -622,7 +623,7 @@ func (request *Request) setCustomHeaders(req *generatedRequest) {
|
||||
|
||||
const CRLF = "\r\n"
|
||||
|
||||
func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.ExecuterOptions, redirectedResponse []byte, formedURL string, responseContentType string) {
|
||||
func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.ExecuterOptions, redirectedResponse []byte, formedURL string, responseContentType string, isResponseTruncated bool) {
|
||||
cliOptions := requestOptions.Options
|
||||
if cliOptions.Debug || cliOptions.DebugResponse {
|
||||
response := string(redirectedResponse)
|
||||
@ -634,7 +635,12 @@ func dumpResponse(event *output.InternalWrappedEvent, requestOptions *protocols.
|
||||
highlightedResult = responsehighlighter.Highlight(event.OperatorsResult, response, cliOptions.NoColor, false)
|
||||
}
|
||||
|
||||
gologger.Debug().Msgf("[%s] Dumped HTTP response for %s\n\n%s", requestOptions.TemplateID, formedURL, highlightedResult)
|
||||
msg := "[%s] Dumped HTTP response %s\n\n%s"
|
||||
if isResponseTruncated {
|
||||
msg = "[%s] Dumped HTTP response (Truncated) %s\n\n%s"
|
||||
}
|
||||
|
||||
gologger.Debug().Msgf(msg, requestOptions.TemplateID, formedURL, highlightedResult)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user