uuWAF/rules/anti-cc.lua

29 lines
553 B
Lua
Raw Normal View History

--[[
: anti cc
:
:
: 访/api/3605ip访
--]]
local sh = ngx.shared.ipCache
2022-09-21 00:32:01 +00:00
local c, f = sh:get("cc" .. waf.ip)
2022-09-21 00:32:01 +00:00
if not waf.startWith(waf.toLower(waf.uri), "/api/") then
return false
end
if not c then
sh:set("cc" .. waf.ip, 0, 60, 1)
else
if f == 2 then
2022-09-21 00:49:53 +00:00
return ngx.exit(444)
elseif c >= 360 then
sh:set("cc" .. waf.ip, c, 300, 2)
end
end
return false