Browse Source

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

pull/2/head
有安科技 2 years ago committed by GitHub
parent
commit
74c0f63302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      rules/anti-cc.lua
  2. 0
      rules/test.lua

28
rules/anti-cc.lua

@ -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

0
rules/test.lua

Loading…
Cancel
Save