2024-10-14 01:54:57 +08:00
|
|
|
package pool
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/chainreactors/parsers"
|
|
|
|
"github.com/chainreactors/spray/pkg"
|
|
|
|
)
|
|
|
|
|
|
|
|
func newUnit(path string, source parsers.SpraySource) *Unit {
|
|
|
|
return &Unit{path: path, source: source}
|
|
|
|
}
|
|
|
|
|
|
|
|
type Unit struct {
|
|
|
|
number int
|
2024-10-14 02:20:16 +08:00
|
|
|
parent int
|
2024-10-14 01:54:57 +08:00
|
|
|
host string
|
|
|
|
path string
|
2024-10-14 02:20:16 +08:00
|
|
|
from parsers.SpraySource
|
2024-10-14 01:54:57 +08:00
|
|
|
source parsers.SpraySource
|
|
|
|
retry int
|
|
|
|
frontUrl string
|
|
|
|
depth int
|
|
|
|
}
|
|
|
|
|
2024-10-14 02:20:16 +08:00
|
|
|
func (u *Unit) Update(bl *pkg.Baseline) {
|
|
|
|
bl.Number = u.number
|
|
|
|
bl.Parent = u.parent
|
|
|
|
bl.Host = u.host
|
|
|
|
bl.Path = u.path
|
|
|
|
bl.Source = u.source
|
|
|
|
}
|
|
|
|
|
2024-10-14 01:54:57 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
type SprayMod int
|
|
|
|
|
|
|
|
const (
|
|
|
|
PathSpray SprayMod = iota + 1
|
|
|
|
HostSpray
|
|
|
|
ParamSpray
|
|
|
|
CustomSpray
|
|
|
|
)
|
|
|
|
|
|
|
|
var ModMap = map[string]SprayMod{
|
|
|
|
"path": PathSpray,
|
|
|
|
"host": HostSpray,
|
|
|
|
}
|