-- deflood version 3.0 -- 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. -- paybacks a biotch!! -- enjoy. plop ---------------------------------------------------------------------- --- the script only kicks by default altho the message says banned. --- change this if you want it 2 really ban. ---------------------------------------------------------------------- --- replace the -- on these lines 2 do so --- user:Disconnect() --- --user:Ban() ---------------------------------------------------------------------- -- name of the bot. Bot="deflood" -- maximum msg's stored from the user MaxStored = 3 -- maximum amount of warnings before it bans for chat flooding Max = 3 -- location/name of the log file file = "logs/flood.log" -- the tables needed msgTable= {} -- 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 } -- 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 -- test 2 filter away msg's (use nil to disable, 1 to enable) AWAY = 1 -- 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 function Main() frmHub:RegBot(Bot) SetTimer(time) StartTimer() end function OnTimer() msgTable= nil msgTable= {} end function DataArrival(user, data) if( strsub(data, 1, 1) == "<" ) then if user.bOperator == nil 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 user:SendPM(Bot, "You are now banned on suspision of using a hub flooder!!|") msg = user.sName.." - "..date().." - banned for using a hub flooder!! (fake nick version)" StoreLog(user.sName, msg) user:Disconnect() --user:Ban() return 1 elseif ChatCheck(user, data) then return 1 end end elseif( strsub(data, 1, 1) == "*" ) then if user.bOperator == nil 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 user.bOperator == nil then data = strsub(data, 1, (strlen(data)-1)) s,e,data = strfind(data, "$%b<>(.+)") if ChatCheck(user, data) then return 1 end end elseif strsub(data, 1, 7) == "$MyINFO" then 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 user:SendPM(Bot, "You are now banned on suspision of using a hub flooder!!|") msg = user.sName.." - "..date().." - banned for using a hub flooder!! (share version)" StoreLog(user.sName, msg) user:Disconnect() --user:Ban() return 1 end end end local _,_,tmp = strfind(data, "%b<>(%d+)%$") if tmp then user:SendPM(Bot, "You are now banned on suspision of using a hub flooder!!|") msg = user.sName.." - "..date().." - banned for using a hub flooder!! (tag version)" StoreLog(user.sName, msg) user:Disconnect() --user:Ban() return 1 end local _,_,nick = strfind(data,"^%$MyINFO %$ALL (%S+)") --if (not nick) or (nick ~= user.sName) then if nick and (nick ~= user.sName) then user:SendPM(Bot, "You are now banned on suspision of using a hub flooder!!|") msg = user.sName.." - "..date().." - banned for using a hub flooder!! (myInfo version)" StoreLog((nick.." -"..user.sName), msg) nick = GetItemByName(nick) if nick then nick:Disconnect() --nick:Ban() end user:Disconnect() --user:Ban() return 1 end --if user.sMyInfoString then s,e,data = strfind(data, "%$ALL%s+%S+(.*)%b<>%$") if data then data = gsub(gsub(data, "-", ""), "", "") for i,v in badTable do local a = gsub(gsub(i, "-",""), "","") local s,e,no = strfind(data, ".*("..a..").*") if no then user:SendPM(Bot, "You are now banned on suspision of using a hub flooder!!|") msg = user.sName.." - "..date().." - banned for using a hub flooder!! (banned on description)" StoreLog(user.sName, msg) user:Disconnect() --user:Ban() return 1 end end end end end function ChatCheck(user, data) local name = user.sName data = gsub(data, "%d", "") -- test, removed all numbers from the line so the flooders can't count 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][i] then if data == msgTable[name][i] 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.." - "..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 user:SendPM(Bot, "You have been warned!! You are now banned for flooding the hub!!") msg = user.sName.." - "..date().." - now banned for flooding. msg was: "..data StoreLog(user.sName, msg) msgTable[name] = nil user:Disconnect() --user:Ban() return 1 else user:SendPM(Bot, "This is warning number "..msgTable[name]["count"]..". After "..Max.." you will be banned!!|") msg = user.sName.." - "..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][i] then count2 = count2 +1 else break end end if count2 >= MaxStored then for i=1,MaxStored do if msgTable[name][i] ~= nil then local tmp = i+1 if msgTable[name][tmp] then msgTable[name][i] = msgTable[name][tmp] else msgTable[name][i]=data break end end end else count2 = count2 +1 msgTable[name][count2]=data end end end function StoreLog(nick, msg) appendto(file) --if type(nick) == "table" then -- nick = nick.sName --end if opchat then SendPmToOps(opchat, msg.."|") else SendPmToOps(Bot, msg.."|") end write(msg.."\n") writeto() msg = nil end