mirror of
https://github.com/Safe3/uusec-waf.git
synced 2025-10-04 06:51:54 +08:00
### Feature Updates **Interface & Management** - Redesigned main program and management interface with improved aesthetics and usability, supports UI language switching (English/Chinese) - Added Rule Collections functionality: Create custom rule templates for batch configuration - Introduced whitelist rules that terminate further rule matching upon success - UUSEC WAF Rules API intelligent suggestions during advanced rule editing:ml-citation - New plugin management supporting hot-reloaded plugins to extend WAF capabilities **Protocol & Optimization** - Supports streaming responses for continuous data push (e.g., LLM stream outputs) - Enables Host header modification during proxying for upstream service access - Search engine validation: `waf.searchEngineValid(dns,ip,ua)` prevents high-frequency rules from affecting SEO indexing - Interception log report generation (HTML/PDF exports) - Automatic rotation of UUSEC WAF error/access logs to prevent performance issues **Security & Infrastructure** - Expanded free SSL certificate support: HTTP-01 & DNS-01 verification across 50+ domain providers - Customizable advanced WAF settings: HTTP2, GZIP, HTTP Caching, SSL protocols, etc - Cluster configuration: Manage UUSEC WAF nodes and ML servers via web UI
32 lines
1.1 KiB
Lua
32 lines
1.1 KiB
Lua
--[[
|
|
Rule name: Robot Attack Protection
|
|
Filtering stage: Request phase
|
|
Threat level: Medium
|
|
Rule description: Intercept robot attacks such as vulnerability scanning, web crawling, CC attacks, and other automated attack behaviors by generating sliding rotation verification pictures, with a token validity period of 30 minutes
|
|
--]]
|
|
|
|
|
|
local sh = waf.ipCache
|
|
local robotIp = 'rb:' .. waf.ip
|
|
local c, f = sh:get(robotIp)
|
|
|
|
-- If it is a static page and no sliding rotation verification has been performed, return
|
|
if not (waf.isQueryString or waf.reqContentLength > 0) and f ~= 2 then
|
|
return false
|
|
end
|
|
|
|
if not c then
|
|
sh:set(robotIp, 1, 60, 1) -- Set 60 second access count time period
|
|
else
|
|
if f == 2 then
|
|
return waf.checkRobot(waf) -- Start robot sliding rotation picture verification
|
|
end
|
|
sh:incr(robotIp, 1)
|
|
if c + 1 >= 360 then
|
|
-- Reached the threshold of requesting more than 360 times within 60 seconds and entered robot verification mode
|
|
sh:set(robotIp, c + 1, 1800, 2)
|
|
return true, robotIp, true
|
|
end
|
|
end
|
|
|
|
return false
|