From 2fe0466ab0a9cf125f93be85617fd7974f9df0f5 Mon Sep 17 00:00:00 2001 From: M09Ic Date: Thu, 10 Nov 2022 17:32:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=80=A7=E8=83=BD,=20precomp?= =?UTF-8?q?are=E7=9A=84=E7=BB=93=E6=9E=9C=E5=B0=86=E8=B7=B3=E8=BF=87collec?= =?UTF-8?q?t=E9=98=B6=E6=AE=B5.=20=E4=BC=98=E5=8C=96check=20failed?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E8=BE=93=E5=87=BA,=20=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E5=AE=8C=E5=85=A8=E4=B8=8D=E7=9B=B8=E7=AD=89=E6=89=8D=E4=BC=9A?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=BE=93=E5=87=BA,=20=E6=A8=A1=E7=B3=8A?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=BE=93=E5=87=BA=E7=A7=BB=E5=88=B0debug?= =?UTF-8?q?=E4=B8=AD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pool.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/pool.go b/internal/pool.go index 5c72dd4..e293d1b 100644 --- a/internal/pool.go +++ b/internal/pool.go @@ -109,8 +109,13 @@ func NewPool(ctx context.Context, config *pkg.Config, outputCh chan *baseline) ( if bl.Err != nil { logs.Log.Warnf("[check.error] maybe ip had banned by waf, break (%d/%d), error: %s", pool.failedCount, breakThreshold, bl.Err.Error()) pool.failedBaselines = append(pool.failedBaselines, bl) - } else if pool.base.Compare(bl) < 1 { - logs.Log.Warn("[check.failed] maybe trigger risk control, " + bl.String()) + } else if i := pool.base.Compare(bl); i < 1 { + if i == 0 { + logs.Log.Debug("[check.fuzzy] maybe trigger risk control, " + bl.String()) + } else { + logs.Log.Warn("[check.failed] maybe trigger risk control, " + bl.String()) + } + pool.failedBaselines = append(pool.failedBaselines, bl) } else { pool.ResetFailed() // 如果后续访问正常, 重置错误次数 @@ -252,6 +257,11 @@ func (p *Pool) comparing() { p.outputCh <- bl continue } + if !bl.IsValid { + // 已经时被precompare过滤的项目, 跳过collect, 直接认为是无效数据 + p.outputCh <- bl + continue + } bl.Collect() if p.EnableFuzzy && p.base.FuzzyEqual(bl) {