mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
fix init panic when request failed
https://github.com/chainreactors/spray/issues/73 https://github.com/chainreactors/spray/issues/72 https://github.com/chainreactors/spray/issues/71
This commit is contained in:
parent
4a0c8f86eb
commit
5cf02cbbcb
@ -334,21 +334,28 @@ func (pool *BrutePool) Invoke(v interface{}) {
|
||||
bl.Spended = time.Since(start).Milliseconds()
|
||||
switch unit.source {
|
||||
case parsers.InitRandomSource:
|
||||
bl.Collect()
|
||||
defer pool.initwg.Done()
|
||||
pool.locker.Lock()
|
||||
pool.random = bl
|
||||
pool.addFuzzyBaseline(bl)
|
||||
if !bl.IsValid {
|
||||
return
|
||||
}
|
||||
pool.locker.Unlock()
|
||||
pool.initwg.Done()
|
||||
case parsers.InitIndexSource:
|
||||
bl.Collect()
|
||||
pool.addFuzzyBaseline(bl)
|
||||
|
||||
case parsers.InitIndexSource:
|
||||
defer pool.initwg.Done()
|
||||
pool.locker.Lock()
|
||||
pool.index = bl
|
||||
pool.locker.Unlock()
|
||||
if !bl.IsValid {
|
||||
return
|
||||
}
|
||||
bl.Collect()
|
||||
pool.doCrawl(bl)
|
||||
pool.doAppend(bl)
|
||||
pool.putToOutput(bl)
|
||||
pool.initwg.Done()
|
||||
case parsers.CheckSource:
|
||||
if bl.ErrString != "" {
|
||||
logs.Log.Warnf("[check.error] %s maybe ip had banned, break (%d/%d), error: %s", pool.BaseURL, pool.failedCount, pool.BreakThreshold, bl.ErrString)
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/vbauerster/mpb/v8"
|
||||
"github.com/vbauerster/mpb/v8/decor"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -366,7 +367,6 @@ func (r *Runner) Output(bl *pkg.Baseline) {
|
||||
|
||||
if bl.IsValid {
|
||||
logs.Log.Console(out + "\n")
|
||||
|
||||
} else if r.Fuzzy && bl.IsFuzzy {
|
||||
logs.Log.Console("[fuzzy] " + out + "\n")
|
||||
}
|
||||
@ -376,6 +376,10 @@ func (r *Runner) Output(bl *pkg.Baseline) {
|
||||
r.OutputFile.SafeWrite(bl.ToJson() + "\n")
|
||||
} else if r.FileOutput == "csv" {
|
||||
r.OutputFile.SafeWrite(bl.ToCSV() + "\n")
|
||||
} else if r.FileOutput == "full" {
|
||||
r.OutputFile.SafeWrite(bl.String() + "\n")
|
||||
} else {
|
||||
r.OutputFile.SafeWrite(bl.Format(strings.Split(r.FileOutput, ",")) + "\n")
|
||||
}
|
||||
|
||||
r.OutputFile.SafeSync()
|
||||
|
Loading…
x
Reference in New Issue
Block a user