mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-07 11:06:23 +00:00
优化过滤规则,现在可以自定义white, black,fuzzy的状态码
This commit is contained in:
parent
779c98487c
commit
f0362b08b0
@ -62,8 +62,9 @@ type ModeOptions struct {
|
|||||||
CheckPeriod int `long:"check-period" default:"100"`
|
CheckPeriod int `long:"check-period" default:"100"`
|
||||||
ErrPeriod int `long:"error-period" default:"10"`
|
ErrPeriod int `long:"error-period" default:"10"`
|
||||||
BreakThreshold int `long:"error-threshold" default:"20"`
|
BreakThreshold int `long:"error-threshold" default:"20"`
|
||||||
BlackStatus string `long:"black-status" default:"default"`
|
BlackStatus string `long:"black-status" default:"404,400,410"`
|
||||||
WhiteStatus string `long:"white-status" `
|
WhiteStatus string `long:"white-status" default:"200"`
|
||||||
|
FuzzyStatus string `long:"fuzzy-status" default:"403,500,501,502,503"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MiscOptions struct {
|
type MiscOptions struct {
|
||||||
@ -128,7 +129,7 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
r.ErrPeriod = max
|
r.ErrPeriod = max
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt.BlackStatus != "default" {
|
if opt.BlackStatus != "" {
|
||||||
for _, s := range strings.Split(opt.BlackStatus, ",") {
|
for _, s := range strings.Split(opt.BlackStatus, ",") {
|
||||||
si, err := strconv.Atoi(s)
|
si, err := strconv.Atoi(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -136,8 +137,6 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
}
|
}
|
||||||
BlackStatus = append(BlackStatus, si)
|
BlackStatus = append(BlackStatus, si)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
BlackStatus = []int{400, 404, 410}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if opt.WhiteStatus != "" {
|
if opt.WhiteStatus != "" {
|
||||||
@ -150,6 +149,16 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opt.FuzzyStatus != "" {
|
||||||
|
for _, s := range strings.Split(opt.FuzzyStatus, ",") {
|
||||||
|
si, err := strconv.Atoi(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
FuzzyStatus = append(FuzzyStatus, si)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// prepare url
|
// prepare url
|
||||||
var urls []string
|
var urls []string
|
||||||
var file *os.File
|
var file *os.File
|
||||||
|
@ -17,8 +17,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
WhiteStatus []int
|
WhiteStatus = []int{200}
|
||||||
BlackStatus []int
|
BlackStatus = []int{400, 404, 410}
|
||||||
FuzzyStatus = []int{403, 500, 501, 502, 503}
|
FuzzyStatus = []int{403, 500, 501, 502, 503}
|
||||||
WAFStatus = []int{493, 418}
|
WAFStatus = []int{493, 418}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user