Beter cripter can opitimise this a bit,
at least it works :-)
----------
-- Code:
----------
-----------------------------------------------------------------
-- A.I. Anti Advertising v1.1 - written by Guibs 21th Apr 2003 --
-----------------------------------------------------------------
---------------------
-- Version History --
---------------------
-- v1.1 Changes synthax about 'strfind' (Thks to sedulus for the tips), by Guibs 21th Apr 2003
-- v1.1 added +allowedadd, +refusedadd commands (Thks to Dazzler for the ideas), by Guibs 21th Apr 2003
-- v1.0 first version. Greets to sebastiannielsen for the cool idea
-- It works in PM, and on the main chat & blocks the bad addresses
-- Ops can't be kicked
-- Edit the safeadd list, to put your good hub addresses
--Converted to lua5 by Hoke
------------------------------------
-- Sourcecode is below this point --
------------------------------------
safeadd = {
["safeadd.no-ip.com1"]=1,
["safeadd.no-ip.com2"]=2,
["safeadd.no-ip.com3"]=3,
["safeadd.no-ip.com4"]=4
}
trigs = {
["dns2go"]=1,
["myftpsite"]=2,
["servebeer"]=3,
["mine.nu"]=4,
["no-ip"]=5,
["dynip"]=6,
["staticip"]=7,
["serveftp"]=8,
["ipactive"]=9,
["ip.org"]=10,
["servegame"]=11,
["ath.cx"]=12,
["dyndns"]=13,
["clanpimp"]=14,
["idlegames"]=15,
["sytes"]=16,
["uni.cc"]=17,
["homeunix"]=18,
["deftonzs.com"]=19,
["flamenap"]=20,
["xs4all"]=21,
["serveftp"]=22,
["myftp"]=23,
["d2g"]=24,
["hopto.org"]=25,
["orgdns"]=26,
["gotdns"]=27,
["baanapojat"]=28,
["finx.org"]=29,
["outwar.com"]=30,
["ihmemaa.org"]=31,
["urlcut.com"]=32,
["no - ip"]=33,
["no ip"]=34,
["no.ip"]=35,
["no .ip"]=36,
["no -ip"]=37,
["80.186.197.96"]=38,
["80.186.197.111"]=39,
["galy.szm"]=40,
["KNUCKLES"]=41,
["/?p=hub&id="]=42,
["h4xx0rd00d"]=43,
["www.sexstreamtv.com"]=44,
["www.pushthebutton.fr"]=45,
["www.ochyda.abc.pl"]=46
}
---------------------
-- Global Settings --
---------------------
Bot = "BotName"
Owner = "RepotToWhom"-- who get report in pm, remember to anable pm from bots in your client settings
------------------
-- Data Arrival --
------------------
function ChatArrival(user, data)
returndata = 0
founded = 0
safe = 0
allowedadd = 0
refusedadd = 0
if (string.sub(data,1,1)=="<") then
data=string.sub(data,1,string.len(data)-1)
s,e,to,cmd=string.find(data,"<(.*)>%s+(%S+)")
cmd=string.lower(cmd)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if user.bOperator then
if (cmd=="+allowedadd") then
user:SendData(Bot, allowedadd.." allowed addresses has been sended on the main chat or in pm")
returndata = 1
elseif (cmd=="+refusedadd") then
user:SendData(Bot, refusedadd.." refused addresses has been sended on the main chat or in pm")
returndata = 1
end
end
if user.bOperator then -- and Owner==1 then
else
for key,a in trigs do
if(string.find(string.lower(data),key,5,1)) then
founded = 1
break
end
end
if founded == 1 then
for safekey,a in safeadd do
if(string.find(string.lower(data),safekey,5,1)) then
safe = 1
break
end
end
end
if founded == 1 then
if safe == 1 then
allowedadd=allowedadd+1
else
returndata = 1
refusedadd=refusedadd+1
SendPmToNick( Owner, Bot, user.sName.."/"..user.sIP.." has been banned because of advertising: "..data )
user:SendData(Bot, "You have been banned because advertising, if this is unnecessary ban then our personel remove that when they have time")
user:Ban() --Unmark this line if you want user no to be banned (nick and IP banned)
user:Disconnect()
end
end
end
end
end
function ToArrival(user, data)
returndata = 0
founded = 0
safe = 0
allowedadd = 0
refusedadd = 0
if (string.sub(data,1,4)=="$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo=string.find(data,"$To:%s+(%S+)")
--cmd=string.lower(cmd)
s,e,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
if user.bOperator then
if (cmd=="+allowedadd") then
user:SendData(Bot, allowedadd.." allowed addresses has been sended on the main chat or in pm")
returndata = 1
elseif (cmd=="+refusedadd") then
user:SendData(Bot, refusedadd.." refused addresses has been sended on the main chat or in pm")
returndata = 1
end
end
if user.bOperator then -- and Owner==1 then
else
for key,a in trigs do
if(string.find(string.lower(data),key,17,1)) then
founded = 1
break
end
end
if founded == 1 then
for safekey,a in safeadd do
if(string.find(string.lower(data),safekey,17,1)) then
safe = 1
break
end
end
end
if founded == 1 then
if safe == 1 then
allowedadd=allowedadd+1
else
returndata = 1
refusedadd=refusedadd+1
SendPmToNick( Owner, Bot, user.sName.."/"..user.sIP.." has been banned because of advertising: "..data )
user:SendData(Bot, "You have been banned because advertising, if this is unnecessary ban then our personel remove that when they have time")
user:Ban() --Unmark this line if you want user no to be banned (nick and IP banned)
user:Disconnect()
end
end
end
end
end