Skip to content

Commit

Permalink
Merge pull request #425 from zerodivisi0n/feature/debug-flag
Browse files Browse the repository at this point in the history
Make http request dump with debug flag
  • Loading branch information
ehsandeep authored Oct 30, 2021
2 parents 672aa49 + 7158b3b commit 32ec662
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ type Options struct {
OutputCName bool
Unsafe bool
Debug bool
DebugRequests bool
DebugResponse bool
Pipeline bool
HTTP2Probe bool
OutputCDN bool
Expand Down Expand Up @@ -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"),
)

Expand Down
9 changes: 9 additions & 0 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 32ec662

Please sign in to comment.