--############################################################################# --## Gekko - Created by Phatty, 24th June 2003 ## --## Current version - v2.02 beta R2a written by Phatty 10th August 2k3 ## --############################################################################# --#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# --# #-# Gekko v2 R3 #-# # --#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# --################# --##--Greets To--## --################# --GingerBitchman, for getting me started off with DC to start with. --CyberSlut, for helping me learn how to server my hub from the beginning. --(uk-kingdom)Oddity and (uk-kingdom)John for helping with testing the bot. --Pur, for lots of help when i got stuck on the bot. --Refael_k and (uk-kingdom)Fritz for the dedication to the hub. --Guibs and Nathanos, Excellent job on CB :) --######### --#-------# --#-Notes-# --#-------# --######### --To disable the triggerbot just move the reply_t.ukc from files/ to another folder --########### --#ChangeLog# --########### --v2.05 R3 Removed all kick commands due to bugs again, By Phatty 12th August 2003 --v2.05 R3 Fixed 2 more bugs, By Phatty 11th August 2003 --v2.04 R3 Fixed 3 bugs with kick commands, By Phatty 11th August 2003 --v2.04 R3 Added Network Founder Entered, Offline, By Phatty 11th August 2003 --v2.04 R3 Added Admin Entered, Offline, By Phatty 11th August 2003 --v2.04 R3 Added Moderator Entered, Offline, By Phatty 11th August 2003 --v2.03 R3 Added Anti-Op kick, kickban, nickban for the commands only, By Phatty 10th August 2003 --v2.03 beta R3 Added -Kickban, -nban, -kick, By Phatty 10th August 2003 --v2.02 beta R2b Added VIP Entered, VIP Offline, By Phatty 10th August 2003 --v2.02 beta R2b Added Master Entered, Master Offline, By Phatty 10th August 2003 --v2.02 beta R2a Added on join welcome msg, By Phatty 9th August 2003 --v2.02 beta R2a Removed anti-advertise and times advert due to bugs, By Phatty 9th August 2003 --v2.02 beta R2a Added -wazzup, boom, cannabis, coffee, By Phatty 9th August 2003 --v2.02 R2 Integrated TriggerBot2.lua Wrote by Ptaczek, By Phatty 8th August 2003 --v2.02 beta R1b Added #afk/-afk, #re/-re, -help, By Phatty 8th August 2003 --v2.01 beta R1a Added timed advert, By Phatty 8th August 2003 --v2.01 beta R1a Added -regme based on Hub Prefix, By Phatty 8th August 2003 --v2.01 R1 Added Advertising warning, By Phatty 7th August 2003 --v2.01 beta6 Added -sethubname, -hide, -unhide, -hubdet, -myip, By Phatty 7th August 2003 --v2.01 beta5 Added BadClient checker, By Phatty 7th August 2003 --v2.01 beta5 Added BadFile Checker, By Phatty 7th August 2003 --v2.01 beta5 Removed PmToOps due to bug, By Phatty 7th August 2003 --v2.01 beta5 Added even more forbidden words, By Phatty 7th August 2003 --v2.01 beta4 Added -sendhubadd, By Phatty 7th August 2003 --v2.01 beta4 Added more forbidden words, By Phatty 7th August 2003 --v2.01 beta3 Fixed 2 bugs, By Phatty 7th August 2003 --v2.01 beta3 Added -4ops, By Phatty 7th August 2003 --v2.01 beta2 Added OpChat, PmToOps, restart notice By Phatty 7th August 2003 --v2.01 beta1 Added badshare check and forbiddenwords, By Phatty 7th August 2003 --v2.01 beta1 Added -rules, -website, -network By Phatty 7th August 2003 --v2.01 beta1 Added Op disconnect, anti avertise By Phatty 7th August 2003 --v2.01 beta1 Added new user connected, and op connected, By Phatty 7th August 2003 --v2.00 Gekko started from scratch, By Phatty 7th August 2003 --v1.021 Fixed 2 bugs thats including the one i made in last version, By Phatty 7th August 2003 --v1.021 Added -website, By Phatty 7th August 2003 --v1.011 Fixed 3 bugs and added 1 :(, By Phatty 25th June 2003 --v1.011 Added anti-advertising, By Phatty 25th June 2003 --v1.011 Added -rules, -network, -mass, By Phatty 25th June 2003 --v1.01 Added -addop, -delop By Phatty 24th June 2003 --v0.5a beta Added -sethubname, -hubname By Phatty 24th June 2003 --v0.5 beta Added -ophelp, -help, -users, -myip, -repass, By Phatty 24th June 2003 --v0.1 beta Started from a kick script, By Phatty 24th June 2003 --############################## --# Uk-kingdom # --############################## --# (c) FreeLance Scripter 2k3 # --############################## --# Gekko # --############################## --##################### --## Bot Start Point ## --##################### Bot = "Gekko"; OPchat = "#Uk-Crew" HubPrefix = "(uk-kingdom)" goneArr={} aMsgs = { BadSyntax = "Use -regme .", RequireTag = "You need to have "..HubPrefix.." in front of your nick in order to register!", ReConnect = "Registration complete, please logon again.", UserExists = "nick is already registered user.", }; forbiddenWords = { "_koala", "mldonkey", "mldc", "_om", "Search", "search", "zearch", "XKing", "repika", "pepek", "moglo", "0.233B", "0.233A", "0.181fr", "0.241A", "0.24A" } valid = {"uk-kingdom1.no-ip.org","www.chocolatecity.co.nr"} tabAdvert = {} badShare = { "10000000000","5368709120","10737418240","13630010000","16106127360", "21474836480","26843545600","27000000000","32212254720","7970010000", "37580963840","37970010000","6599201000000","65992010000000","36772010000000", "3677201000000","42949672960","48318382080","214266156265","53687091200", "59055800320","1747201000000","16772010000000","147720100000000","10240000000000", "64424509440","65719010000","69793218560","75161927680","80530636800","85899345920", "91268055040","96636764160","102005473280","102400000000","107374182400","118648471552", "128849018880","140301549174","161061273600","174720100000","183287729356","214748364800", "268435456000","322122547200","375809638400","397760100000","429496729600","536870912000", "657190100000","1024000000000","183287729357","102392020337","13625783747","174719269601", "65712999629","26993869455","140295106724","199715979264" } Files = { --["F?T?0?7?preteen"]="Please don't share porn in here!", --["F?T?0?6?preteen"]="Please don't share porn in here!", --["F?T?0?7?andrew blake"]="Please don't share porn in here!", --["F?T?0?6?andrew blake"]="Please don't share porn in here!", --["F?T?0?7?masturbati"]="Please don't share porn in here!", --["F?T?0?6?masturbati"]="Please don't share porn in here!", --["F?T?0?7?handjob"]="Please don't share porn in here!", --["F?T?0?6?handjob"]="Please don't share porn in here!", --["F?T?0?7?incest"]="Please don't share porn in here!", --["F?T?0?7?schoolgirl"]="Please don't share porn in here!", --["F?T?0?6?schoolgirl"]="Please don't share porn in here!", --["F?T?0?7?teenage sex"]="Please don't share porn in here!", --["F?T?0?6?teenage sex"]="Please don't share porn in here!", --["F?T?0?7?-moi$lolita"]="Please don't share porn in here!", --["F?T?0?6?-moi$lolita"]="Please don't share porn in here!", --["F?F?0?1?MyList.bz2"]="Do not share unzipped DC folder here!", --["F?F?0?1?.tmp"]="Do not share temporaly files here!", --["F?F?0?1?__incomplete__"]="Do not share incompleted files here!", --["F?F?0?1?taskman.exe"]="Do not share Windows directory here!", --["F?F?0?1?msoobe.exe"]="Do not share Program Files directory here!", --["F?F?0?1?hmmapi.dll"]="Do not share Program Files directory here!", --["F?F?0?1?MyList.DcLst"]="Do not share unzipped DC folder here!", --["F?F?0?1?msimn.exe"]="Do not share Program Files directory here!", --["F?F?0?1?windowsshell.manifest"]="Do not share Windows directory here!", --["F?F?0?1?explorer.scf"]="Do not share Windows directory here!", } trigall=1 RepFile="files/reply_t.ukc" function Main() frmHub:RegBot(Bot) frmHub:RegBot(OPchat) SendToAll(" <<<< GEKKO HAS BEEN RESTARTED >>>>") trigs = parseINI(RepFile) SetTimer(60000) StartTimer() end function parseINI(fName) readfrom(fName) local line = read() local table = {} while line do local s, e, sec = strfind(line, "^%[(.*)%]$") if s then section = sec table[section] = {} else assert(section, "parseINI: format problem with "..fName) tinsert(table[section], line) end line = read() end readfrom() return table end -- function parseINI(fName) function writeINI(fName, table) assert(table, "writeINI: table not found") local fHandle = openfile(fName, "w") if fHandle then for id,entry in table do write(fHandle, "["..id.."]\n") for i=1,getn(entry) do write(fHandle, entry[i].."\n") end end -- for id,entry closefile(fHandle) end -- if fHandle end function hbns(data) if( strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind( data, "%b<>%s+(%S+)" ) s,e,cmd,us = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*") return us end end function checkFake(user) local s, e, shared = strfind(user.sMyInfoString, "$ALL %S+ .-$ $.+.$.-$(%d+)") return foreachi(badShare, function(id, value) if value == %shared then return id end end) end function NewUserConnected(user) if (user.iProfile == 2) then SendToAll("VIP Entered", ""..user.sName.." has entered the hub.") end if (user.iProfile == 3) then SendToAll("Registered", ""..user.sName.." has entered the hub.") end if (user.iProfile == -1) then SendToAll("New Guest", ""..user.sName.." has entered the hub.") end user:SendPM("Gekko","Hello and welcome to the uk-kingdom hub 1, this hub is a ptokax test hub but you are welcome to stay") user:SendPM("Gekko","The HubMaster is not responsible for what you share, share at own risk.") if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client") user:Disconnect() end end function UserDisconnected(curUser) if (curUser.iProfile == 2) then SendToAll("VIP Offline", ""..curUser.sName.." is offline.") end end function OpConnected(user) if (user.iProfile == 7) then SendToAll("Network Founder Entered", ""..user.sName.." has entered the hub.") end if (user.iProfile == -0) then SendToAll("Master Entered", ""..user.sName.." has entered the hub.") end if (user.iProfile == 5) then SendToAll("Moderator Entered", ""..user.sName.." has entered the hub.") end if (user.iProfile == 6) then SendToAll("Admin Entered", ""..user.sName.." has entered the hub.") end if (user.iProfile == 1) then SendToAll("OP Entered", ""..user.sName.." has entered the hub.") end if checkFake(user) then user:SendData("*** You seem to be using a fakeshare client") user:Disconnect() end end function OpDisconnected(curUser) if (curUser.iProfile == 7) then SendToAll("Network Founder Offline", ""..curUser.sName.." is offline.") end if (curUser.iProfile == -0) then SendToAll("Master Offline", ""..curUser.sName.." is offline.") end if (curUser.iProfile == 5) then SendToAll("Moderator Offline", ""..curUser.sName.." is offline.") end if (curUser.iProfile == 6) then SendToAll("Admin Entered", ""..curUser.sName.." is offline.") end if (curUser.iProfile == 1) then SendToAll("OP Offline", ""..curUser.sName.." is offline.") end end function OnTimer() SendToAll( Bot, answer ) -- send bot's answer StopTimer() end function DataArrival(user, data) local nick = user.sName; local _, _, cmd, Password = strfind(strsub(data, 1, strlen(data)-1), "%b<>%s+(%S+)%s*([^%|]*)$"); if (not cmd) then return 0; end; cmd = strlower(cmd); if (cmd == "-regme") then user:SendData(data); if (strlen(Password) > 0) then if (strfind(nick, HubPrefix, 1, 1)) then if (user.iProfile == -1) then AddRegUser(nick, Password, GetProfileIdx("Reg")); user:SendData(Bot, aMsgs.ReConnect); user:Disconnect(); else user:SendData(Bot, aMsgs.UserExists); end else user:SendData(Bot, aMsgs.RequireTag); end else SendToNick(nick, nick, "test"); user:SendData(Bot, aMsgs.BadSyntax); end return 1; end if( strsub(data, 1, 1) == "<" ) then -- remove pipe at the end data=strsub(data,1,strlen(data)-1) s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+([%w%s]+)" ) if (arg==nil) then s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" ) end if (cmd=="#afk" or cmd=="-afk") then SendToAll(Bot,date("User "..user.sName.." told us at %T that he is away, because ")..arg.." ;)") goneArr[user.sName]=arg end if (cmd=="#re" or cmd=="-re") then SendToAll(Bot,date("User "..user.sName.." returned at %T .")) goneArr[user.sName]=nil end end if(strsub(data, 1, 4) == "$To:") then -- remove end pipe data=strsub(data,1,strlen(data)-1) -- is this meant for an away user? s,e,whoTo = strfind(data,"$To:%s+(%S+)") if (goneArr[whoTo] == nil) then --user is here else user:SendPM(whoTo,"I am currently away, because of: "..goneArr[whoTo]) end end status=strsub(data,1,strlen(data)-1) -- parse the command s,e,cmd = strfind( status, "%b<>%s+(%S+)" ) if (cmd=="+quiet") then trigall=0 SendToAll(Bot, " Hmf, Okidoki I will be quiet :(( ") return 1 elseif (cmd=="+talk") then trigall=1 SendToAll(Bot, " Okay, I will talk to you again :-)") return 1 end if( strsub(data, 1, 1) == "<" ) then -- get the msg only using regular expression s,e,msg = strfind(data, "%b<>([%a ]+)") -- look in the table if trigall==1 then for key, value in trigs do for key2, value2 in value do if( strfind( strlower(msg), key) ) then else break end if( strfind( strlower(msg), "!me") ) then t="**"..user.sName data=gsub (msg, "!me", t, 1 ) end SendToAll( data ) SetTimer(1800) StartTimer() answer, x = gsub(value[random(1,getn(value))], "%b[]", user.sName) return 1; -- tell the hub we have processed the data end end end end if( strsub(data, 1, 1) == "<" ) then if (user.bOperator) then if( strfind( strlower(data), strlower("-sethubname")) ) then us = hbns(data) frmHub:SetHubName(us) answer= "The Hub name is now: "..us.."" user:SendPM(Bot, answer) end end end if (user.bOperator) then if( strfind( strlower(data), strlower("-hide")) ) then frmHub:UnregBot(Bot) end end if (user.bOperator) then if( strfind( strlower(data), strlower("-unhide")) ) then frmHub:RegBot(Bot) end end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-hubdet")) ) then answer= "The Hub name is "..frmHub:GetHubName().."" user:SendPM(Bot, answer) answer= "The user limit: "..frmHub:GetMaxUsers().."" user:SendPM(Bot, answer) answer= "Users online right now is: "..frmHub:GetUsersCount().."" user:SendPM(Bot, answer ) answer= "The Minimum share is set to: "..frmHub:GetMinShare().."bytes" user:SendPM(Bot, answer ) answer= "The current share in hub is: "..frmHub:GetCurrentShareAmount().."bytes" user:SendPM(Bot, answer ) end end if( strfind( strlower(data), strlower("-myip")) ) then answer= "Your IP-Nr is: "..user.sIP.."" user:SendPM(Bot, answer ) end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-rules")) ) then readfrom("files/rules.gek") while 1 do line = read() if line == nil then break end user:SendPM("Gekko",line) end readfrom() end end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-network")) ) then readfrom("files/nt.gek") while 1 do line = read() if line == nil then break end user:SendPM("Gekko",line) end readfrom() end end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-wazzup")) ) then readfrom("files/wazzup.asci") while 1 do line = read() if line == nil then break end SendToAll("Gekko",line) end readfrom() end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-boom")) ) then readfrom("files/boom.asci") while 1 do line = read() if line == nil then break end SendToAll("Gekko",line) end readfrom() end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-cannabis")) ) then readfrom("files/cannabis.asci") while 1 do line = read() if line == nil then break end SendToAll("Gekko",line) end readfrom() end end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-coffee")) ) then readfrom("files/coffee.asci") while 1 do line = read() if line == nil then break end SendToAll("Gekko",line) end readfrom() end end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-website")) ) then readfrom("files/webby.gek") while 1 do line = read() if line == nil then break end user:SendPM("Gekko",line) end readfrom() end end if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-help")) ) then readfrom("files/help.gek") while 1 do line = read() if line == nil then break end user:SendPM("Gekko",line) end readfrom() end end if user.bOperator then if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-4ops")) ) then readfrom("files/4OPs.gek") while 1 do line = read() if line == nil then break end user:SendPM("Gekko",line) end readfrom() end if user.bOperator then if( strsub(data, 1, 1) == "<" ) then if( strfind( strlower(data), strlower("-sendhubadd")) ) then readfrom("files/hubadd.gek") while 1 do line = read() if line == nil then break end SendToAll(line) end readfrom() end end end end end end end end --################# --# Bot End Point # --#################