mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-06 18:51:22 +00:00
fix --check-only panic
This commit is contained in:
parent
3da923b2a8
commit
006e1af2db
@ -764,16 +764,3 @@ func (pool *BrutePool) resetFailed() {
|
||||
pool.failedCount = 1
|
||||
pool.FailedBaselines = nil
|
||||
}
|
||||
|
||||
func NewBaselines() *Baselines {
|
||||
return &Baselines{
|
||||
baselines: map[int]*pkg.Baseline{},
|
||||
}
|
||||
}
|
||||
|
||||
type Baselines struct {
|
||||
FailedBaselines []*pkg.Baseline
|
||||
random *pkg.Baseline
|
||||
index *pkg.Baseline
|
||||
baselines map[int]*pkg.Baseline
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package pool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/chainreactors/logs"
|
||||
"github.com/chainreactors/parsers"
|
||||
"github.com/chainreactors/spray/internal/ihttp"
|
||||
@ -19,9 +20,10 @@ func NewCheckPool(ctx context.Context, config *Config) (*CheckPool, error) {
|
||||
pctx, cancel := context.WithCancel(ctx)
|
||||
pool := &CheckPool{
|
||||
&This{
|
||||
Config: config,
|
||||
ctx: pctx,
|
||||
Cancel: cancel,
|
||||
Config: config,
|
||||
Statistor: pkg.NewStatistor(""),
|
||||
ctx: pctx,
|
||||
Cancel: cancel,
|
||||
client: ihttp.NewClient(&ihttp.ClientConfig{
|
||||
Thread: config.Thread,
|
||||
Type: config.ClientType,
|
||||
@ -112,7 +114,7 @@ func (pool *CheckPool) Invoke(v interface{}) {
|
||||
defer fasthttp.ReleaseRequest(req.FastRequest)
|
||||
}
|
||||
|
||||
if reqerr != nil && reqerr != fasthttp.ErrBodyTooLarge {
|
||||
if reqerr != nil && !errors.Is(reqerr, fasthttp.ErrBodyTooLarge) {
|
||||
pool.failedCount++
|
||||
bl = &pkg.Baseline{
|
||||
SprayResult: &parsers.SprayResult{
|
||||
@ -156,9 +158,11 @@ func (pool *CheckPool) Invoke(v interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
if bl.Source == parsers.CheckSource {
|
||||
pool.Bar.Done()
|
||||
}
|
||||
pool.reqCount++
|
||||
pool.wg.Done()
|
||||
pool.Bar.Done()
|
||||
}
|
||||
|
||||
func (pool *CheckPool) doRedirect(bl *pkg.Baseline, depth int) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package pool
|
||||
|
||||
import "github.com/chainreactors/parsers"
|
||||
import (
|
||||
"github.com/chainreactors/parsers"
|
||||
"github.com/chainreactors/spray/pkg"
|
||||
)
|
||||
|
||||
func newUnit(path string, source parsers.SpraySource) *Unit {
|
||||
return &Unit{path: path, source: source}
|
||||
@ -18,3 +21,16 @@ type Unit struct {
|
||||
frontUrl string
|
||||
depth int // redirect depth
|
||||
}
|
||||
|
||||
func NewBaselines() *Baselines {
|
||||
return &Baselines{
|
||||
baselines: map[int]*pkg.Baseline{},
|
||||
}
|
||||
}
|
||||
|
||||
type Baselines struct {
|
||||
FailedBaselines []*pkg.Baseline
|
||||
random *pkg.Baseline
|
||||
index *pkg.Baseline
|
||||
baselines map[int]*pkg.Baseline
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user