From b9bcebdceec0b40b33dbc854d43ab9907da9804e Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Mon, 21 Jun 2021 08:52:14 +0200 Subject: [PATCH] Adding hex output for network request/response --- v2/pkg/protocols/network/request.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v2/pkg/protocols/network/request.go b/v2/pkg/protocols/network/request.go index ceebf160..b4129117 100644 --- a/v2/pkg/protocols/network/request.go +++ b/v2/pkg/protocols/network/request.go @@ -127,8 +127,9 @@ func (r *Request) executeAddress(actualAddress, address, input string, shouldUse r.options.Progress.IncrementRequests() if r.options.Options.Debug || r.options.Options.DebugRequests { + requestOutput := reqBuilder.String() gologger.Info().Str("address", actualAddress).Msgf("[%s] Dumped Network request for %s", r.options.TemplateID, actualAddress) - gologger.Print().Msgf("%s", reqBuilder.String()) + gologger.Print().Msgf("%s\nHex: %s", requestOutput, hex.EncodeToString([]byte(requestOutput))) } r.options.Output.Request(r.options.TemplateID, actualAddress, "network", err) @@ -147,8 +148,9 @@ func (r *Request) executeAddress(actualAddress, address, input string, shouldUse responseBuilder.Write(final[:n]) if r.options.Options.Debug || r.options.Options.DebugResponse { + responseOutput := responseBuilder.String() gologger.Debug().Msgf("[%s] Dumped Network response for %s", r.options.TemplateID, actualAddress) - gologger.Print().Msgf("%s", responseBuilder.String()) + gologger.Print().Msgf("%s\nHex: %s", responseOutput, hex.EncodeToString([]byte(responseOutput))) } outputEvent := r.responseToDSLMap(reqBuilder.String(), string(final[:n]), responseBuilder.String(), input, actualAddress) outputEvent["ip"] = r.dialer.GetDialedIP(hostname)