From a0a97e6d09bda89899410f6843e5471405d5f707 Mon Sep 17 00:00:00 2001 From: savik Date: Thu, 19 Nov 2020 10:51:56 +0300 Subject: [PATCH] add reqURL to json output --- v2/pkg/executer/executer_http.go | 4 ++-- v2/pkg/executer/output_http.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/v2/pkg/executer/executer_http.go b/v2/pkg/executer/executer_http.go index 5f0ccbb6..ea23aeb3 100644 --- a/v2/pkg/executer/executer_http.go +++ b/v2/pkg/executer/executer_http.go @@ -537,7 +537,7 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest, result.Meta = request.Meta result.GotResults = true result.Unlock() - e.writeOutputHTTP(request, resp, body, matcher, nil, result.Meta) + e.writeOutputHTTP(request, resp, body, matcher, nil, result.Meta, reqURL) } } } @@ -568,7 +568,7 @@ func (e *HTTPExecuter) handleHTTP(reqURL string, request *requests.HTTPRequest, // Write a final string of output if matcher type is // AND or if we have extractors for the mechanism too. if len(outputExtractorResults) > 0 || matcherCondition == matchers.ANDCondition { - e.writeOutputHTTP(request, resp, body, nil, outputExtractorResults, result.Meta) + e.writeOutputHTTP(request, resp, body, nil, outputExtractorResults, result.Meta, reqURL) result.Lock() result.GotResults = true result.Unlock() diff --git a/v2/pkg/executer/output_http.go b/v2/pkg/executer/output_http.go index c1e86a65..c40ead5a 100644 --- a/v2/pkg/executer/output_http.go +++ b/v2/pkg/executer/output_http.go @@ -12,7 +12,7 @@ import ( ) // writeOutputHTTP writes http output to streams -func (e *HTTPExecuter) writeOutputHTTP(req *requests.HTTPRequest, resp *http.Response, body string, matcher *matchers.Matcher, extractorResults []string, meta map[string]interface{}) { +func (e *HTTPExecuter) writeOutputHTTP(req *requests.HTTPRequest, resp *http.Response, body string, matcher *matchers.Matcher, extractorResults []string, meta map[string]interface{}, reqURL string) { var URL string if req.RawRequest != nil { URL = req.RawRequest.FullURL @@ -28,6 +28,7 @@ func (e *HTTPExecuter) writeOutputHTTP(req *requests.HTTPRequest, resp *http.Res if !e.noMeta { output["template"] = e.template.ID output["type"] = "http" + output["host"] = reqURL if len(meta) > 0 { output["meta"] = meta }