From c263c11926e18ca102b2ff6efbd663eb339cde3d Mon Sep 17 00:00:00 2001 From: M09Ic Date: Tue, 7 Feb 2023 18:37:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A0=E6=95=88=E9=87=8D?= =?UTF-8?q?=E5=AE=9A=E5=90=91=E9=A1=B5=E9=9D=A2=E7=9A=84=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pool.go | 13 ++++++++++--- internal/runner.go | 2 +- internal/types.go | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/internal/pool.go b/internal/pool.go index 02de40e..e34980c 100644 --- a/internal/pool.go +++ b/internal/pool.go @@ -384,9 +384,7 @@ func (pool *Pool) Handler() { status = true } } else { - if pool.BaseCompare(bl) { - status = true - } + status = pool.BaseCompare(bl) } if status { @@ -475,6 +473,15 @@ func (pool *Pool) PreCompare(resp *ihttp.Response) error { func (pool *Pool) BaseCompare(bl *pkg.Baseline) bool { var status = -1 + + // 30x状态码的特殊处理 + if strings.HasSuffix(bl.RedirectURL, bl.Url.Path+"/") { + bl.Reason = ErrFuzzyRedirect.Error() + pool.putToFuzzy(bl) + return false + } + + // 使用与baseline相同状态码, 需要在fuzzystatus中提前配置 base, ok := pool.baselines[bl.Status] // 挑选对应状态码的baseline进行compare if !ok { if pool.index != nil { diff --git a/internal/runner.go b/internal/runner.go index a911463..0b4fad2 100644 --- a/internal/runner.go +++ b/internal/runner.go @@ -20,7 +20,7 @@ var ( WhiteStatus = []int{200} BlackStatus = []int{400, 410} FuzzyStatus = []int{403, 404, 500, 501, 502, 503} - WAFStatus = []int{493, 418, 1020} + WAFStatus = []int{493, 418, 1020, 406} ) var ( diff --git a/internal/types.go b/internal/types.go index 821a178..4633113 100644 --- a/internal/types.go +++ b/internal/types.go @@ -15,6 +15,7 @@ const ( ErrRedirect ErrCompareFailed ErrFuzzyCompareFailed + ErrFuzzyRedirect ErrCustomCompareFailed ErrCustomFilter ) @@ -35,6 +36,8 @@ func (e ErrorType) Error() string { return "compare failed" case ErrFuzzyCompareFailed: return "fuzzy compare failed" + case ErrFuzzyRedirect: + return "fuzzy redirect" case ErrCustomCompareFailed: return "custom compare failed" case ErrCustomFilter: