Skip to content

Commit

Permalink
misc changes fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed Dec 2, 2024
1 parent 2fc1b3a commit fda6165
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit fda6165

Please sign in to comment.