Skip to content

Commit df397c2

Browse files
authored
Merge pull request #470 from projectdiscovery/issue-460-srd-flag
Enabling store response automatically if output directory is specified
2 parents 72ce90e + 27aef8c commit df397c2

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ MISCELLANEOUS:
128128
-paths string File or comma separated paths to request (deprecated)
129129

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

140140
CONFIGURATIONS:
141141
-r, -resolvers string[] List of custom resolvers (file or comma separated)

runner/options.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,14 @@ func ParseOptions() *Options {
263263
)
264264

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

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

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

0 commit comments

Comments
 (0)