From 13ad1e6a46e98df4ab267e7f413fc595954706a2 Mon Sep 17 00:00:00 2001 From: Alexey Zhuchkov Date: Sat, 23 Oct 2021 13:59:51 +0300 Subject: [PATCH 1/2] Add request dump for debug flag --- runner/options.go | 4 ++++ runner/runner.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/runner/options.go b/runner/options.go index d88b00241..d1881e008 100644 --- a/runner/options.go +++ b/runner/options.go @@ -167,6 +167,8 @@ type Options struct { OutputCName bool Unsafe bool Debug bool + DebugRequests bool + DebugResponse bool Pipeline bool HTTP2Probe bool OutputCDN bool @@ -295,6 +297,8 @@ func ParseOptions() *Options { flagSet.BoolVar(&options.Verbose, "verbose", false, "Verbose mode"), flagSet.BoolVar(&options.Version, "version", false, "Display version"), flagSet.BoolVar(&options.Debug, "debug", false, "Debug mode"), + flagSet.BoolVar(&options.DebugRequests, "debug-req", false, "Show all sent requests"), + flagSet.BoolVar(&options.DebugResponse, "debug-resp", false, "Show all received responses"), flagSet.BoolVar(&options.ShowStatistics, "stats", false, "Display scan statistic"), ) diff --git a/runner/runner.go b/runner/runner.go index 8ecaefb59..1619006f2 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -846,6 +846,15 @@ retry: } fullURL = parsedURL.String() + if r.options.Debug || r.options.DebugRequests { + gologger.Info().Msgf("Dumped HTTP request for %s\n\n", fullURL) + gologger.Print().Msgf("%s", string(requestDump)) + } + if r.options.Debug || r.options.DebugResponse { + gologger.Info().Msgf("Dumped HTTP response for %s\n\n", fullURL) + gologger.Print().Msgf("%s", string(resp.Raw)) + } + builder := &strings.Builder{} builder.WriteString(stringz.RemoveURLDefaultPort(fullURL)) From 7158b3b0079066e65b1da3a3f23d8c916666f53c Mon Sep 17 00:00:00 2001 From: Alexey Zhuchkov Date: Sat, 23 Oct 2021 14:44:33 +0300 Subject: [PATCH 2/2] Update README with debug flags --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dd607f177..7b98b050e 100644 --- a/README.md +++ b/README.md @@ -160,11 +160,13 @@ CONFIGURATIONS: -sd, -skip-dedupe Disable dedupe input items (only used with stream mode) DEBUG: - -silent Silent mode - -verbose Verbose mode - -version Display version - -debug Debug mode - -stats Display scan statistic + -silent Silent mode + -verbose Verbose mode + -version Display version + -debug Debug mode + -debug-req Show all sent requests + -debug-resp Show all received responses + -stats Display scan statistic OPTIMIZATIONS: -retries int Number of retries