deflood 4.3
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

deflood 4.3

Started by Dj_OcTaGoN, 22 August, 2004, 22:21:12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dj_OcTaGoN

Well i got a big problem with this script...
I was going to check a filelist of one of my users, then i got kicked because i was a suspicious flooder... and im the owner...when i reconnect i will get kicked at the time i enter...Anyway the only thing i have changed is the botname and it says after a while that there is an error. And i have wondered why many users get kicked (1-5/hour), i suppose when they try to download a filelist from anyone deflood thinks they are a hubflooder.
I would appreciate all info available!


Typhoon

QuoteOriginally posted by Dj_OcTaGoN
Well i got a big problem with this script...
I was going to check a filelist of one of my users, then i got kicked because i was a suspicious flooder... and im the owner...when i reconnect i will get kicked at the time i enter...Anyway the only thing i have changed is the botname and it says after a while that there is an error. And i have wondered why many users get kicked (1-5/hour), i suppose when they try to download a filelist from anyone deflood thinks they are a hubflooder.
I would appreciate all info available!

update to the newest version ..

newest i believe are 4.3.6 ..

*** Typhoon?



Dj_OcTaGoN

Hmmm cant access Plops website...anywhere else to get this deflooder version?


ARCHANGEL

version 4.3.6 by plop in 2 parts.

---------------------------------------------
-- deflood version 4.x
---------------------------------------------
-- pre V4.x things
-----
-- only filter chat for unreged users.
-- bounch the flood msg back 2 the sender.
-- now kicks after x times (user is warned).
-- added phatty's ban on description.
-- added chilla's script against the myInfo flooder.
-- added share check thx psf8500.
-- added choise on were 2 show the msg's 2 the ops (own window or opchat).
-- added test by removing numbers from the msg, so chat flooders can't count in there msg.
-- added detection for user flooders which show a number behind the tag.
-- added filter for me mode.
-- added filter so away msg don't get seen as flooding.
---------------------------------------------
-- V4+
-----
-- added filter for crimson.
-- added filter for omega.
-- added filter for midnight.
-- changed logs now also store the ip's of the banned users.
-- thx to ruri_ruri for helping on this new version of deflood,
---------------------------------------------
-- V4.1
-----
-- fixed strfind error.
---------------------------------------------
-- V4.2
-----
-- added direct kick/ban for the pm/chat flooders.
-- small optimization on the description table.
---------------------------------------------
-- V4.3
-----
-- added protection against GetNickList floods (thx to psf8500).
-- added protection against fake MyInfo's with random chars (thx to psf8500).
-- added protection against fake IP's on ConnectToMe (thx to psf8500).
-- changed removed the need for 2 versions of deflood, mode can be set from the script now.
-- changed made it optional to set what to do with flooders (no need 2 mod the script anymore).
---------------------------------------------
-- V4.3.1
-----
-- changed the amount of times a user can do $GetNickList can be set from the config.
-- added table with imune IP's on the fake $ConnectToMe's (some hubowners need this).
---------------------------------------------
-- V4.3.2
-----
-- changed the $ConnectToMe has now only the option to do a timeban of x minutes.
-- instead of showing "you banned" it gives the correct IP and links to some site's
-- with info about how to setup active mode while being behind a router.
---------------------------------------------
-- V4.3.3
-----
-- changed the $ConnectToMe check now disconnects private ip ranges, and tells them the right IP to use
-- changed reason msg send to the kicked/banned users matched the kick/ban type.
---------------------------------------------
-- V4.3.4
-----
-- fixed bug on not kicking/banning (thx reefa)
-- fixed bug on level checking (thx reefa)
---------------------------------------------
-- V4.3.5
-----
-- quick fix for the !me flooder from TE
---------------------------------------------
-- V4.3.6
-----
-- added filter for the scrolling statusbar flooder (thx "unknown"/plop/sUiCiDeMAniC/RabidWombat)
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
-- paybacks a biotch!!
-- enjoy. plop
-- http://www.plop.nl
----------------------------------------------------------------------
--- the script only kicks by default altho the message says banned.
--- change this if you want it 2 really ban.
----------------------------------------------------------------------


-- name of the bot.
Bot="deflood"

-- maximum msg's stored from the user
MaxStored = 6

-- maximum amount of warnings before it bans for chat flooding
Max = 3

-- location/name of the log file
file = "logs/flood.log"

-- filter levels. use 1 for everything but OP's, nil for the table with level numbers.
iMode = 1
tMode = { [-1] = 1 }

------- do what to flooders.
-- use nil for disconnect, 1 for a kick, 2 for a ban, 3 for a tempban, 4 for a timeban.
iKill = nil
-- if timeban then how many minutes.
iTimeBan = 15
-- time the tempban on bad IP's in the dc active setup should last
-- (don't make it 2 long, mostly this check hits on bad settings but it could be a flooder
-- but keep it above 5 so the automatic reconnect from dc++ doesn't make it flood you opchat/logs).
iConnect = 8

-- the table for banning by description (["search string"] = number)
badTable = { ["Ruri_Ruri"]=1, ["R u r i_ R u r i "]=2, ["TEAMELITE"]=3, ["F8X0R"]=4, ["KNUCKLES"]=5, ["OPZONE"]=6,["K-N-U-C-K-L-E-S"]=7, ["Meka_Meka"]=8, ["O-M-E-G-A"]=9, ["OMEGA"]=10 }
--badTable = { ["ruri_ruri"]=1, --["R u r i_ R u r i "]=2, ["TEAMELITE"]=3, ["F8X0R"]=4, ["KNUCKLES"]=5, ["OPZONE"]=6,["K-N-U-C-K-L-E-S"]=7, ["Meka_Meka"]=8, ["O-M-E-G-A"]=9, ["OMEGA"]=10 }

-- name of the opchat so the output of this script shows up there instead of it's own window
-- comment this for own window (aka place -- before it like this text has)
opchat = "-OPChat-"  -- fill in the name here if you use a scripted opchat
--opchat = frmHub:GetOpChatName()     -- uncomment this and make the above a comment if you use the ptokax build-in opchat

-- filter away msg's (use nil to disable, 1 to enable)
AWAY = 1

-- don't check the next IP's on fake $ConnectToMe's
-- (for hub owners who are behind a NAT router)
tIPs = { ["127.0.0.1"] = 1, ["127.0.0.2"] = 1 }

-- don't even think about changing the next table (private ip ranges in decimal format)
tPriv = {
   [3232235520] = 3232301055,
   [2886729728] = 2887778303,
   [167772160] = 184549375
}
   
-- max amount of times someone can do $GetNickList before deflood treads it as a flooder.
iMaxGetNick = 5

-- explain the script what seconds, minutes, hours and day's are
sec = 1000
min = 60 * sec
hour = 60 * min
day = 12 * hour

-- timer between table flushes
-- 10 * sec == 10 sec memory
-- 2 * hour == 2 hour memory
time = 10 * sec

-- the tables needed
msgTable= {}
tShare = {}
tNames = {}
tMyInfo = {}
tGetNick = {}

function Main()
   frmHub:EnableFullData(1)
   frmHub:RegBot(Bot)
   SetTimer(time)
   StartTimer()
   badTable2 = {}
   for i,v in badTable do
      local a = gsub(gsub(gsub(i, "-",""), "?", ""), " ","")
      a = strlower(a)
      badTable2[a]=1
   end
   badTable = nil
end

function OnTimer()
   msgTable= nil
   tShare = nil
   tNames = nil
   tMyInfo = nil
   tGetNick = nil
   msgTable= {}
   tShare = {}
   tNames = {}
   tMyInfo = {}
   tGetNick = {}
end

function ByeBye(user)
   if iKill == 1 then
      user:SendPM(Bot,  "You are now kicked on suspision of using a hub flooder!!|")
      user:Kick()
   elseif iKill == 2 then
      user:SendPM(Bot,  "You are now banned on suspision of using a hub flooder!!|")
      user:Ban()
   elseif iKill == 3 then
      user:SendPM(Bot,  "You are now temp banned on suspision of using a hub flooder!!|")
      user:TempBan()
   elseif iKill == 4 then
      user:SendPM(Bot,  "You are now time banned on suspision of using a hub flooder for the next "..iTimeBan.." minutes!!|")
      user:TimeBan(iTimeBan)
   else
      user:SendPM(Bot,  "You are now disconnected on suspision of using a hub flooder!!|")
      user:Disconnect()
   end
   return 1
end

function CheckLevel(user)
   if iMode then
      return user.bOperator
   else
      return not tMode[user.iProfile]
   end
end

function DataArrival(user, data)
   if strfind(data, "']['?AM?LiT? OWN?D YOU") then
      msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (!me flooder)"
      StoreLog(user.sName, msg)
      return ByeBye(user)

ARCHANGEL

--version 4.3.6 by plop part 2

elseif( strsub(data, 1, 1) == "<" ) then
      if not CheckLevel(user) then
         data = strsub(data, 1, (strlen(data)-1))
         s,e,nick, data = strfind(data, "^(%b<>)(.+)")
         nick = GetItemByName(strsub(nick, 2, -2))
         if nick == nil then
            msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (fake nick version)"
            StoreLog(user.sName, msg)
            return ByeBye(user)
           
         elseif ChatCheck(user, data) then
            return 1
         end
      end
     
   elseif( strsub(data, 1, 1) == "*" ) then
      if not CheckLevel(user) then
         data = strsub(data, 1, (strlen(data)-1))
         s,e,data = strfind(data, "^%*%s*(.+)")
         if ChatCheck(user, data) then
            return 1
         end
      end
     
   elseif(strsub(data, 1, 4) == "$To:") then
      if not CheckLevel(user) then
         data = strsub(data, 1, (strlen(data)-1))
         s,e,data = strfind(data, "$%b<>(.+)")
         local t,c = gsub(data, "xXxX", "")
         if c >1 then
            msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a client flooder!!"
            StoreLog(user.sName, msg)
            return ByeBye(user)
         elseif ChatCheck(user, data) then
            return 1
         end
      end
     
   elseif strsub(data, 1, 12) == "$GetNickList" then
      if tGetNick[user.sName] == nil then
         tGetNick[user.sName] = 1
      else
         tGetNick[user.sName] = tGetNick[user.sName] +1
         if tGetNick[user.sName] >= iMaxGetNick then
            tGetNick[user.sName] = nil
            msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (GetNickList flood)"
            StoreLog(user.sName, msg)
            return ByeBye(user)
         end
      end
     
   elseif strsub(data, 1, 12) == "$ConnectToMe" then
      local s,e,ip = strfind(data, "(%S+):%d+|$")
      if ip and tIPs[user.sIP] == nil then
         if ip ~= user.sIP then
            local s,e,dIP1,dIP2,dIP3,dIP4 = strfind(ip, "(%d+)%.(%d+)%.(%d+)%.(%d+)")
            dIP1 = (tonumber(dIP1) * 16777216) + (tonumber(dIP2) *65536) + (tonumber(dIP3) * 256) + (tonumber(dIP4))
            for a,b in tPriv do
               if dIP1 >= a and dIP1 <= b then
                  user:SendPM(Bot, "You either left the IP box from your active settings empty or you placed a private IP in there by accident!\r\n"..
                     "IP's like this will not resolve outside your local network, change it for "..user.sIP.."|")
                  user:Disconnect()
                  return 1
               end
            end
            user:SendPM(Bot, "You have the wrong IP in the active settings from your DC client!!\r\n"..
               "You have set it to "..ip..", the IP you should have set it on is: "..user.sIP..".\r\n"..
               "For Safety reasons you are now banned for "..iConnect.." minutes\r\n"..
               "For more info about how to setup active mode you should look at the next website's:\r\n"..
               "Default router setup manual: --->  http://www.plop.nl/lua_tools/dc-active.zip\r\n"..
               "Specialized router manuals: ---> http://www.portforward.com\r\n"..
               "Official dc++ faq: ---> http://dcplusplus.sourceforge.net/faq/faq.php?display=faq&faqnr=11&catnr=2&prog=1&lang=en&onlynewfaq=1 |")
            msg = user.sName.." - "..user.sIP.." - "..date().." - time banned for a wrong ip in the $ConnectToMe, but this could be a hub flooder!! (bad/fake ConnectToMe)"
            StoreLog(user.sName, msg)
            user:TimeBan(iConnect)
            --user:Disconnect()
            return 1
         end
      end
     
   elseif strsub(data, 1, 7) == "$MyINFO" then
      if tMyInfo[user.sName] == nil then
         tMyInfo[user.sName] = 1
      else
         tMyInfo[user.sName] = tMyInfo[user.sName] +1
         local t =(frmHub:GetUsersCount()+10)
         if tMyInfo[user.sName] >= t then
            tMyInfo[user.sName] = nil
            msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (myInfo flood)"
            StoreLog(user.sName, msg)
            return ByeBye(user)
         end
      end
     
      local i,j,temp = strfind(data, "$(%d+)%$")
      if temp then
         if strlen(temp) >= 11 then
            temp = strsub(temp, -11, -1)
            if tonumber(temp) ==  99511627776 then
               msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (share version)"
               StoreLog(user.sName, msg)
               return ByeBye(user)
            end
         end
      end
     
      local _,_,tmp = strfind(data, "%b<>(%d+)%$")
      if tmp then
         msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (tag version)"
         StoreLog(user.sName, msg)
         return ByeBye(user)
      end
     
      local _,_,nick = strfind(data,"^%$MyINFO %$ALL (%S+)")
      if nick and (nick ~= user.sName) then
         msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (myInfo version)"
         StoreLog((nick.." -"..user.sName), msg)
         nick = GetItemByName(nick)
         if nick then
            ByeBye(nick)
         end
         return ByeBye(user)
      end
     
      local name = gsub(user.sName, "%d", "")
      if strlen(name) == 0 then
         msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (banned on nickname)"
         StoreLog(user.sName, msg)
         return ByeBye(user)
      end
     
      s,e,data = strfind(data, "%$ALL%s+%S+(.*)%b<>%$")
      if data then
         data = strlower(data)
         data = gsub(gsub(gsub(data, "-", ""), "?", ""), " ", "")
         for i,v in badTable2 do
            local s,e,no = strfind(data, ".*("..i..").*")
            if no then
               msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (banned on description)"
               StoreLog(user.sName, msg)
               return ByeBye(user)
            end
         end
         
         local s,e,share = strfind(data, "$(%d+)%$")
         if share then
            if tShare[share] == nil then
               tShare[share] = 1
               tNames[user.sName] = 1
            elseif tNames[user.sName] == nil then
               msg = user.sName.." - "..user.sIP.." - "..date().." - banned for using a hub flooder!! (banned on share match)"
               StoreLog(user.sName, msg)
               return ByeBye(user)
            end
         end
      end
   end
end

function ChatCheck(user, data)
   local name = user.sName
   data = gsub(data, "[%s%d]", "")
   if AWAY then
      s,e,away = strfind(data,"(%b<>)$")
      if away then
         return
      end
   end
   local count = 0
   if msgTable[name] == nil then
      msgTable[name] = {}
      msgTable[name][1]=data
      return
   else
      for i=1,MaxStored do
         if msgTable[name] then
            if data == msgTable[name] then
               if msgTable[name]["count"] == nil then
                  user:SendPM(Bot, "Stop flooding you fool :"..data.."|")
                  user:SendPM(Bot, "This is your 1st warning. After "..Max.." you will be banned!!|")
                  msgTable[name]["count"]=1
                  msg = user.sName.." - "..user.sIP.." - "..date().." - flood warning number: 1. msg was: "..data
                  StoreLog(user.sName, msg)
                  count = 1
                  return 1
               else
                  msgTable[name]["count"]=msgTable[name]["count"] +1
                  if msgTable[name]["count"] >= Max then
                     what = "You have been warned!! You are now banned for flooding the hub!!"
                     msg = user.sName.." - "..user.sIP.." - "..date().." - now banned for flooding. msg was: "..data
                     StoreLog(user.sName, msg)
                     msgTable[name] = nil
                     user:SendPM(Bot, what.."|")
                     return ByeBye(user)
                  else
                     user:SendPM(Bot, "This is warning number "..msgTable[name]["count"]..". After "..Max.." you will be banned!!|")
                     msg = user.sName.." - "..user.sIP.." - "..date().." - flood warning number: "..msgTable[name]["count"]..". msg was: "..data
                     StoreLog(user.sName, msg)
                     return 1
                  end
               end
            end
         end
      end
   end
   if count == 0 then
      local count2 = 0
      for i=1,MaxStored do
         if msgTable[name] then
            count2 = count2 +1
         else
            break
         end
      end
      if count2 >= MaxStored then
         for i=1,MaxStored do
            if msgTable[name] ~= nil then
               local tmp = i+1
               if msgTable[name][tmp] then
                  msgTable[name] = msgTable[name][tmp]
               else
                  msgTable[name]=data
                  break
               end
            end
         end
      else
         count2 = count2 +1
         msgTable[name][count2]=data
      end
   end
end

function StoreLog(nick, msg)
   appendto(file)
   if opchat then
      SendPmToOps(opchat, msg.."|")
   else
      SendPmToOps(Bot, msg.."|")
   end
   write(msg.."\n")
   writeto()
   msg = nil
end

Dj_OcTaGoN

Thanks, seems to work a lot better...i hope.....


ARCHANGEL


Dj_OcTaGoN

#7
Ok, i encounter a problem with this Deflood 4.3.6 script now:
Syntax error: `for' table must be a table
stack traceback:
   1:  function `Main' at line 159 [file `...:\-= PtokaX [debug] =-\scripts\deflood4.3.6.lua']

And i have found it still kicks a lot of ppl...


this is not unusual (those 38.118 i know is BOTs):
[2004-08-24 16:51] User nyoung was kicked. IP: 38.118.154.14
[2004-08-24 16:52] User [tele2][0.5MBit]jimbo was kicked. IP: 38.118.154.9
[2004-08-24 17:01] Private message from -OPChat-: <-OPChat->  - 82.254.100.xxx - 08/24/04 17:01:57 - banned for using a hub flooder!! (banned on nickname)
[2004-08-24 17:02] Private message from -OPChat-: <-OPChat->  - 195.158.168.xx - 08/24/04 17:02:14 - banned for using a hub flooder!! (banned on nickname)
[2004-08-24 17:10] Private message from -OPChat-: <-OPChat->  - 213.103.95.xxx - 08/24/04 17:10:39 - banned for using a hub flooder!! (banned on nickname)
[2004-08-24 17:12] Private message from -OPChat-: <-OPChat->  - 62.202.49.xx - 08/24/04 17:12:39 - banned for using a hub flooder!! (banned on nickname)

I dunno why, is it so many users doing wrong? or am i being attacked whole days/nights?


plop

my site is back online, grab it from there.
deflood always shows the nickname of the person it kicks/bans.
but as you can see they are missing on these.
what deflood is kicking are nil nicks (empty nicks).
check the topic i made for deflood for more info.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[NL]trucker

Plop

could you make the part $connectToMe as a standalone?
this is the part where the user on connect gets a message when he has a wrong ip in settings of his client.

would be nice if it sends a pm to OP,s or Owners of the hub.

with the IP that is in settings of that client and wich it should be.

think it would be great to have this one as now it is sending to OPchat only and there is no record kept off.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


plop

QuoteOriginally posted by [NL]trucker
Plop

could you make the part $connectToMe as a standalone?
this is the part where the user on connect gets a message when he has a wrong ip in settings of his client.

would be nice if it sends a pm to OP,s or Owners of the hub.

with the IP that is in settings of that client and wich it should be.

think it would be great to have this one as now it is sending to OPchat only and there is no record kept off.
you allready started it so i'm gone leave the honor 2 you 2 finish it.
check the pm in your own hub.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

ok I have a little query to ask of you..

I also run a trivia bot and my main bot alongside this checker.. problem is standard commands such as !hint !tbquestion !tbskip are used in great frequency..

problem is that the flooder kicks the trivia players when they are asking for a hint etc...

is there a way of omitting a word, ie if !hint then ignore, BUT and heres a big but - still allowing the !hint to be processed by the TRIVIA script :)

thanks in advance

Stravvie
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

QuoteOriginally posted by Stravides
ok I have a little query to ask of you..

I also run a trivia bot and my main bot alongside this checker.. problem is standard commands such as !hint !tbquestion !tbskip are used in great frequency..

problem is that the flooder kicks the trivia players when they are asking for a hint etc...

is there a way of omitting a word, ie if !hint then ignore, BUT and heres a big but - still allowing the !hint to be processed by the TRIVIA script :)

thanks in advance

Stravvie
change the order of the scripts.
make trivia run before deflood and then all the other scripts.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

how do I do that ???
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

QuoteOriginally posted by Stravides
how do I do that ???
mostly it's enough 2 change the filename.
1filename.lua
2filename.lua
3filename.lua

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk