Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling store response automatically if output directory is specified #470

Merged
merged 2 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ MISCELLANEOUS:
-paths string File or comma separated paths to request (deprecated)

OUTPUT:
-o, -output string File to write output
-sr, -store-response Store HTTP responses
-srd, -store-response-dir string Custom directory to store HTTP responses (default "output")
-json Output in JSONL(ines) format
-irr, -include-response Include HTTP request/response in JSON output (-json only)
-include-chain Include redirect HTTP Chain in JSON output (-json only)
-store-chain Include HTTP redirect chain in responses (-sr only)
-csv Output in CSV format
-o, -output string file to write output
-sr, -store-response store http response to output directory
-srd, -store-response-dir string store http response to custom directory (default "output")
-csv store output in CSV format
-json store output in JSONL(ines) format
-irr, -include-response include http request/response in JSON output (-json only)
-include-chain include redirect http chain in JSON output (-json only)
-store-chain include http redirect chain in responses (-sr only)

CONFIGURATIONS:
-r, -resolvers string[] List of custom resolvers (file or comma separated)
Expand Down
20 changes: 12 additions & 8 deletions runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ func ParseOptions() *Options {
)

createGroup(flagSet, "output", "Output",
flagSet.StringVarP(&options.Output, "output", "o", "", "File to write output"),
flagSet.BoolVarP(&options.StoreResponse, "store-response", "sr", false, "Store HTTP responses"),
flagSet.StringVarP(&options.StoreResponseDir, "store-response-dir", "srd", "output", "Custom directory to store HTTP responses"),
flagSet.BoolVar(&options.JSONOutput, "json", false, "Output in JSONL(ines) format"),
flagSet.BoolVarP(&options.responseInStdout, "include-response", "irr", false, "Include HTTP request/response in JSON output (-json only)"),
flagSet.BoolVar(&options.chainInStdout, "include-chain", false, "Include redirect HTTP Chain in JSON output (-json only)"),
flagSet.BoolVar(&options.StoreChain, "store-chain", false, "Include HTTP redirect chain in responses (-sr only)"),
flagSet.BoolVar(&options.CSVOutput, "csv", false, "Output in CSV format"),
flagSet.StringVarP(&options.Output, "output", "o", "", "file to write output results"),
flagSet.BoolVarP(&options.StoreResponse, "store-response", "sr", false, "store http response to output directory"),
flagSet.StringVarP(&options.StoreResponseDir, "store-response-dir", "srd", "output", "store http response to custom directory"),
flagSet.BoolVar(&options.CSVOutput, "csv", false, "store output in CSV format"),
flagSet.BoolVar(&options.JSONOutput, "json", false, "store output in JSONL(ines) format"),
flagSet.BoolVarP(&options.responseInStdout, "include-response", "irr", false, "include http request/response in JSON output (-json only)"),
flagSet.BoolVar(&options.chainInStdout, "include-chain", false, "include redirect http chain in JSON output (-json only)"),
flagSet.BoolVar(&options.StoreChain, "store-chain", false, "include http redirect chain in responses (-sr only)"),
)

createGroup(flagSet, "configs", "Configurations",
Expand Down Expand Up @@ -391,7 +391,11 @@ func (options *Options) validateOptions() {
options.Resolvers = resolvers
if len(options.Resolvers) > 0 {
gologger.Debug().Msgf("Using resolvers: %s\n", strings.Join(options.Resolvers, ","))
}

if options.StoreResponseDir != "" && !options.StoreResponse {
gologger.Debug().Msgf("Store response directory specified, enabling \"sr\" flag automatically\n")
options.StoreResponse = true
}
}

Expand Down