mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 19:50:18 +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.failedCount = 1
|
||||||
pool.FailedBaselines = nil
|
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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"github.com/chainreactors/logs"
|
"github.com/chainreactors/logs"
|
||||||
"github.com/chainreactors/parsers"
|
"github.com/chainreactors/parsers"
|
||||||
"github.com/chainreactors/spray/internal/ihttp"
|
"github.com/chainreactors/spray/internal/ihttp"
|
||||||
@ -20,6 +21,7 @@ func NewCheckPool(ctx context.Context, config *Config) (*CheckPool, error) {
|
|||||||
pool := &CheckPool{
|
pool := &CheckPool{
|
||||||
&This{
|
&This{
|
||||||
Config: config,
|
Config: config,
|
||||||
|
Statistor: pkg.NewStatistor(""),
|
||||||
ctx: pctx,
|
ctx: pctx,
|
||||||
Cancel: cancel,
|
Cancel: cancel,
|
||||||
client: ihttp.NewClient(&ihttp.ClientConfig{
|
client: ihttp.NewClient(&ihttp.ClientConfig{
|
||||||
@ -112,7 +114,7 @@ func (pool *CheckPool) Invoke(v interface{}) {
|
|||||||
defer fasthttp.ReleaseRequest(req.FastRequest)
|
defer fasthttp.ReleaseRequest(req.FastRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
if reqerr != nil && reqerr != fasthttp.ErrBodyTooLarge {
|
if reqerr != nil && !errors.Is(reqerr, fasthttp.ErrBodyTooLarge) {
|
||||||
pool.failedCount++
|
pool.failedCount++
|
||||||
bl = &pkg.Baseline{
|
bl = &pkg.Baseline{
|
||||||
SprayResult: &parsers.SprayResult{
|
SprayResult: &parsers.SprayResult{
|
||||||
@ -156,9 +158,11 @@ func (pool *CheckPool) Invoke(v interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if bl.Source == parsers.CheckSource {
|
||||||
|
pool.Bar.Done()
|
||||||
|
}
|
||||||
pool.reqCount++
|
pool.reqCount++
|
||||||
pool.wg.Done()
|
pool.wg.Done()
|
||||||
pool.Bar.Done()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pool *CheckPool) doRedirect(bl *pkg.Baseline, depth int) {
|
func (pool *CheckPool) doRedirect(bl *pkg.Baseline, depth int) {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package pool
|
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 {
|
func newUnit(path string, source parsers.SpraySource) *Unit {
|
||||||
return &Unit{path: path, source: source}
|
return &Unit{path: path, source: source}
|
||||||
@ -18,3 +21,16 @@ type Unit struct {
|
|||||||
frontUrl string
|
frontUrl string
|
||||||
depth int // redirect depth
|
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