From 40edb1323dcd27f698c1a75821576ddbfb1ff40f Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 5 Sep 2022 10:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BCaptcha=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/waf/captcha_counter.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/waf/captcha_counter.go b/internal/waf/captcha_counter.go index a812575..f62d80e 100644 --- a/internal/waf/captcha_counter.go +++ b/internal/waf/captcha_counter.go @@ -5,6 +5,7 @@ package waf import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/TeaOSLab/EdgeNode/internal/ttlcache" + "github.com/TeaOSLab/EdgeNode/internal/utils" "github.com/TeaOSLab/EdgeNode/internal/waf/requests" "github.com/iwind/TeaGo/types" "time" @@ -50,5 +51,14 @@ func CaptchaDeleteCacheKey(req requests.Request) { // CaptchaCacheKey 获取Captcha缓存Key func CaptchaCacheKey(req requests.Request, pageCode CaptchaPageCode) string { - return "CAPTCHA:FAILS:" + pageCode + ":" + req.WAFRemoteIP() + ":" + types.String(req.WAFServerId()) + ":" + req.WAFRaw().URL.String() + var requestPath = req.WAFRaw().URL.Path + + if req.WAFRaw().URL.Path == CaptchaPath { + m, err := utils.SimpleDecryptMap(req.WAFRaw().URL.Query().Get("info")) + if err == nil && m != nil { + requestPath = m.GetString("url") + } + } + + return "CAPTCHA:FAILS:" + pageCode + ":" + req.WAFRemoteIP() + ":" + types.String(req.WAFServerId()) + ":" + requestPath }