Fixed verbose output for sent requests

dev
Ice3man543 2021-01-11 19:59:12 +05:30
parent ff3b0e116d
commit 9c81680173
3 changed files with 8 additions and 6 deletions

View File

@ -45,7 +45,7 @@ func (r *Request) ExecuteWithResults(input string, metadata output.InternalEvent
gologger.Info().Msgf("[%s] Dumped file request for %s", r.options.TemplateID, data)
fmt.Fprintf(os.Stderr, "%s\n", dataStr)
}
gologger.Verbose().Msgf("[%s] Sent file request to %s", r.options.TemplateID, data)
gologger.Verbose().Msgf("[%s] Sent FILE request to %s", r.options.TemplateID, data)
ouputEvent := r.responseToDSLMap(dataStr, input, data)
event := &output.InternalWrappedEvent{InternalEvent: ouputEvent}

View File

@ -234,12 +234,13 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
fmt.Fprintf(os.Stderr, "%s", string(dumpedRequest))
}
var formedURL string
timeStart := time.Now()
if request.original.Pipeline {
formedURL = request.rawRequest.FullURL
resp, err = request.pipelinedClient.DoRaw(request.rawRequest.Method, reqURL, request.rawRequest.Path, generators.ExpandMapValues(request.rawRequest.Headers), ioutil.NopCloser(strings.NewReader(request.rawRequest.Data)))
} else if request.original.Unsafe {
// rawhttp
// burp uses "\r\n" as new line character
formedURL = request.rawRequest.FullURL
request.rawRequest.Data = strings.ReplaceAll(request.rawRequest.Data, "\n", "\r\n")
options := request.original.rawhttpClient.Options
options.AutomaticContentLength = !r.DisableAutoContentLength
@ -247,6 +248,7 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
options.FollowRedirects = r.Redirects
resp, err = request.original.rawhttpClient.DoRawWithOptions(request.rawRequest.Method, reqURL, request.rawRequest.Path, generators.ExpandMapValues(request.rawRequest.Headers), ioutil.NopCloser(strings.NewReader(request.rawRequest.Data)), options)
} else {
formedURL = request.request.URL.String()
// if nuclei-project is available check if the request was already sent previously
if r.options.ProjectFile != nil {
// if unavailable fail silently
@ -270,7 +272,7 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
r.options.Progress.DecrementRequests(1)
return err
}
gologger.Verbose().Msgf("Sent request to %s", reqURL)
gologger.Verbose().Msgf("[%s] Sent HTTP request to %s", r.options.TemplateID, formedURL)
r.options.Output.Request(r.options.TemplateID, reqURL, "http", err)
duration := time.Since(timeStart)
@ -304,7 +306,7 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
// Dump response - step 2 - replace gzip body with deflated one or with itself (NOP operation)
if r.options.Options.Debug {
dumpedResponse = bytes.ReplaceAll(dumpedResponse, dataOrig, data)
gologger.Info().Msgf("[%s] Dumped HTTP response for %s\n\n", r.options.TemplateID, reqURL)
gologger.Info().Msgf("[%s] Dumped HTTP response for %s\n\n", r.options.TemplateID, formedURL)
fmt.Fprintf(os.Stderr, "%s\n", string(dumpedResponse))
}

View File

@ -104,7 +104,7 @@ func (r *Request) executeAddress(actualAddress, address, input string, callback
}
r.options.Output.Request(r.options.TemplateID, actualAddress, "network", err)
gologger.Verbose().Msgf("[%s] Sent Network request to %s", r.options.TemplateID, actualAddress)
gologger.Verbose().Msgf("Sent TCP request to %s", actualAddress)
bufferSize := 1024
if r.ReadSize != 0 {