diff --git a/internal/nodes/http_request_waf.go b/internal/nodes/http_request_waf.go index 9b524f9..47d0e56 100644 --- a/internal/nodes/http_request_waf.go +++ b/internal/nodes/http_request_waf.go @@ -421,3 +421,8 @@ func (this *HTTPRequest) WAFFingerprint() []byte { return nil } + +// DisableAccessLog 在当前请求中不使用访问日志 +func (this *HTTPRequest) DisableAccessLog() { + this.disableLog = true +} diff --git a/internal/waf/requests/request.go b/internal/waf/requests/request.go index 2ad5f1f..ed275b1 100644 --- a/internal/waf/requests/request.go +++ b/internal/waf/requests/request.go @@ -37,4 +37,7 @@ type Request interface { // Format 格式化变量 Format(string) string + + // DisableAccessLog 在当前请求中不使用访问日志 + DisableAccessLog() } diff --git a/internal/waf/requests/test_request.go b/internal/waf/requests/test_request.go index ab9b218..2482bf9 100644 --- a/internal/waf/requests/test_request.go +++ b/internal/waf/requests/test_request.go @@ -76,3 +76,11 @@ func (this *TestRequest) Format(s string) string { func (this *TestRequest) WAFOnAction(action interface{}) bool { return true } + +func (this *TestRequest) WAFFingerprint() []byte { + return nil +} + +func (this *TestRequest) DisableAccessLog() { + +} diff --git a/internal/waf/waf.go b/internal/waf/waf.go index 6d6975c..609cfe7 100644 --- a/internal/waf/waf.go +++ b/internal/waf/waf.go @@ -250,12 +250,14 @@ func (this *WAF) MatchRequest(req requests.Request, writer http.ResponseWriter) // validate captcha var rawPath = req.WAFRaw().URL.Path if rawPath == CaptchaPath { + req.DisableAccessLog() captchaValidator.Run(req, writer) return } // Get 302验证 if rawPath == Get302Path { + req.DisableAccessLog() get302Validator.Run(req, writer) return }