From fda616533d3a4bc8446264dae48977b0c35bfcad Mon Sep 17 00:00:00 2001 From: Ice3man Date: Mon, 2 Dec 2024 19:14:41 +0530 Subject: [PATCH] misc changes fix --- internal/runner/runner.go | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index f7258ada40..68dc2710f4 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -284,6 +284,42 @@ func New(options *types.Options) (*Runner, error) { } runner.resumeCfg = resumeCfg + if options.DASTReport || options.DASTServer { + var err error + runner.fuzzStats, err = fuzzStats.NewTracker() + if err != nil { + return nil, errors.Wrap(err, "could not create fuzz stats db") + } + if !options.DASTServer { + dastServer, err := server.NewStatsServer(runner.fuzzStats) + if err != nil { + return nil, errors.Wrap(err, "could not create dast server") + } + runner.dastServer = dastServer + } + } + + // Create the output file if asked + outputWriter, err := output.NewStandardWriter(options) + if err != nil { + return nil, errors.Wrap(err, "could not create output file") + } + if runner.fuzzStats != nil { + outputWriter.RequestHook = func(request *output.JSONLogRequest) { + if request.Error == "none" || request.Error == "" { + return + } + runner.fuzzStats.RecordErrorEvent(fuzzStats.ErrorEvent{ + TemplateID: request.Template, + URL: request.Input, + Error: request.Error, + }) + } + } + + // setup a proxy writer to automatically upload results to PDCP + runner.output = runner.setupPDCPUpload(outputWriter) + opts := interactsh.DefaultOptions(runner.output, runner.issuesClient, runner.progress) opts.Debug = runner.options.Debug opts.NoColor = runner.options.NoColor @@ -337,42 +373,6 @@ func New(options *types.Options) (*Runner, error) { runner.tmpDir = tmpDir } - if options.DASTReport || options.DASTServer { - var err error - runner.fuzzStats, err = fuzzStats.NewTracker() - if err != nil { - return nil, errors.Wrap(err, "could not create fuzz stats db") - } - if !options.DASTServer { - dastServer, err := server.NewStatsServer(runner.fuzzStats) - if err != nil { - return nil, errors.Wrap(err, "could not create dast server") - } - runner.dastServer = dastServer - } - } - - // Create the output file if asked - outputWriter, err := output.NewStandardWriter(options) - if err != nil { - return nil, errors.Wrap(err, "could not create output file") - } - if runner.fuzzStats != nil { - outputWriter.RequestHook = func(request *output.JSONLogRequest) { - if request.Error == "none" || request.Error == "" { - return - } - runner.fuzzStats.RecordErrorEvent(fuzzStats.ErrorEvent{ - TemplateID: request.Template, - URL: request.Input, - Error: request.Error, - }) - } - } - - // setup a proxy writer to automatically upload results to PDCP - runner.output = runner.setupPDCPUpload(outputWriter) - return runner, nil }