Update and rename test.lua to anti-cc.lua

pull/2/head
有安科技 2 years ago committed by GitHub
parent c5bfb4bf08
commit 74c0f63302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,28 @@
--[[
: anti cc
:
:
: 访/api/3605ip访
--]]
local sh = ngx.shared.ipCache
local c, f = sh:get(waf.ip)
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
return ngx.exit(403)
elseif c >= 360 then
sh:set("cc" .. waf.ip, c, 300, 2)
end
end
return false
Loading…
Cancel
Save