Block IP permanently after a few failed login attempts

You can share your Lua Scripts with everybody here.
DomDis
Posts: 33
Joined: Sat Mar 18, 2023 7:44 pm

Re: Block IP permanently after a few failed login attempts

Post by DomDis »

FTP wrote: Mon Jun 26, 2023 3:43 am You need to replace the string "DomainName" into your real domain name, or just use the variable "%Domain" for the event script. And here are the Lua scripts for adding domain/admin IP rules:

Code: Select all

--add domain IP rules
local ipmasks = c_GetIPMaskList("%Domain")
local g_ipmasks = {}
if type(ipmasks) == "table" then
   for _,ipmask in pairs(ipmasks) do
      local temp = {}
      table.insert(temp,ipmask.ip)
      table.insert(temp,ipmask.refuse)
      table.insert(temp,ipmask.comment)
      table.insert(g_ipmasks,temp)
   end
end
table.insert(g_ipmasks,{"%IP",true})
c_SetIPMaskList("%Domain", g_ipmasks)

Code: Select all

--add admin IP rules
local ipmasks = c_GetAdminIPMaskList()
local g_ipmasks = {}
if type(ipmasks) == "table" then
   for _,ipmask in pairs(ipmasks) do
      local temp = {}
      table.insert(temp,ipmask.ip)
      table.insert(temp,ipmask.refuse)
      table.insert(temp,ipmask.comment)
      table.insert(g_ipmasks,temp)
   end
end
table.insert(g_ipmasks,{"%IP",true})
c_SetAdminIPMaskList(g_ipmasks)
Thank you SO MUCH I really appreciate it!!! In the event that I have to reverse one of these will I be able to see these entries through the WingFTP client ?
Post Reply