Skip to content

Commit fda6165

Browse files
committed
misc changes fix
1 parent 2fc1b3a commit fda6165

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

internal/runner/runner.go

+36-36
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,42 @@ func New(options *types.Options) (*Runner, error) {
284284
}
285285
runner.resumeCfg = resumeCfg
286286

287+
if options.DASTReport || options.DASTServer {
288+
var err error
289+
runner.fuzzStats, err = fuzzStats.NewTracker()
290+
if err != nil {
291+
return nil, errors.Wrap(err, "could not create fuzz stats db")
292+
}
293+
if !options.DASTServer {
294+
dastServer, err := server.NewStatsServer(runner.fuzzStats)
295+
if err != nil {
296+
return nil, errors.Wrap(err, "could not create dast server")
297+
}
298+
runner.dastServer = dastServer
299+
}
300+
}
301+
302+
// Create the output file if asked
303+
outputWriter, err := output.NewStandardWriter(options)
304+
if err != nil {
305+
return nil, errors.Wrap(err, "could not create output file")
306+
}
307+
if runner.fuzzStats != nil {
308+
outputWriter.RequestHook = func(request *output.JSONLogRequest) {
309+
if request.Error == "none" || request.Error == "" {
310+
return
311+
}
312+
runner.fuzzStats.RecordErrorEvent(fuzzStats.ErrorEvent{
313+
TemplateID: request.Template,
314+
URL: request.Input,
315+
Error: request.Error,
316+
})
317+
}
318+
}
319+
320+
// setup a proxy writer to automatically upload results to PDCP
321+
runner.output = runner.setupPDCPUpload(outputWriter)
322+
287323
opts := interactsh.DefaultOptions(runner.output, runner.issuesClient, runner.progress)
288324
opts.Debug = runner.options.Debug
289325
opts.NoColor = runner.options.NoColor
@@ -337,42 +373,6 @@ func New(options *types.Options) (*Runner, error) {
337373
runner.tmpDir = tmpDir
338374
}
339375

340-
if options.DASTReport || options.DASTServer {
341-
var err error
342-
runner.fuzzStats, err = fuzzStats.NewTracker()
343-
if err != nil {
344-
return nil, errors.Wrap(err, "could not create fuzz stats db")
345-
}
346-
if !options.DASTServer {
347-
dastServer, err := server.NewStatsServer(runner.fuzzStats)
348-
if err != nil {
349-
return nil, errors.Wrap(err, "could not create dast server")
350-
}
351-
runner.dastServer = dastServer
352-
}
353-
}
354-
355-
// Create the output file if asked
356-
outputWriter, err := output.NewStandardWriter(options)
357-
if err != nil {
358-
return nil, errors.Wrap(err, "could not create output file")
359-
}
360-
if runner.fuzzStats != nil {
361-
outputWriter.RequestHook = func(request *output.JSONLogRequest) {
362-
if request.Error == "none" || request.Error == "" {
363-
return
364-
}
365-
runner.fuzzStats.RecordErrorEvent(fuzzStats.ErrorEvent{
366-
TemplateID: request.Template,
367-
URL: request.Input,
368-
Error: request.Error,
369-
})
370-
}
371-
}
372-
373-
// setup a proxy writer to automatically upload results to PDCP
374-
runner.output = runner.setupPDCPUpload(outputWriter)
375-
376376
return runner, nil
377377
}
378378

0 commit comments

Comments
 (0)