Author Topic: anti advertiser fix?  (Read 1556 times)

0 Members and 1 Guest are viewing this topic.

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 577
  • Karma: +71/-5
anti advertiser fix?
« on: 05 May, 2004, 19:25:43 »
can someone edit this script, so that it also catches this kind of pub: t.e.s.t.n.o.-.i.p.c.o.m?

the code is below:

-----


BotName = "bot"

HubAddress = "hub.no-ip.com"

-- Set On/Off if user should be kicked for advertising / 1:on/0:off
ADKICK = 0

OKHUBS = {
   ["hub.no-ip.com"] = 1,
}

ADVER = {
["serveftp"]=1,["dns2go"]=2,["ip.com"]=3
}

SITES = { "www.","http://","ftp://","irc.","cs." }

tabAdvert = {}
PMCount = {}
MainCount = {}
awayArray = {}
RegTable = {}
UserInfo = {}
TabTimers = {n=0}
KickTable = {}
BanTable = {}
WarnTable = {}
Online = {}
Counter = {}
TopKickers = {}

CmdErrorMsg = "*** Syntax error in command"
CmdErrorPar = " No parameter given."

function Main()

--REG BOTS--------------------------------------------------------------------------------------------------
   frmHub:RegBot(BotName)

function SMPM(curUser)
   if (MPM==1)  then
      curUser.SD = function(this,from,text)
            this:SendPM(from,text)
         end
   else
      curUser.SD = function(this,from,text)
            this:SendData(from,text)
         end
   end
   return curUser
end

function DataArrival(curUser, data)
   SMPM(curUser)
      if ( strsub(data, 1, 1) == "<" ) then
      local _, _, msg = strfind(data, "^%b<>%s+(.*)|")
      if not curUser.bOperator then
         if SiteCheck(msg)==1 then
            return 0
         else
            if Verify(curUser.sName, msg) then
               local Lines = Verify(curUser.sName, msg)
               tabAdvert = nil
               tabAdvert = {}
               local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
               if (FindAdver(adver) == "K") then
               return 0
               else
                  SendPmToOps (BotName,"Report: <"..curUser.sName.."> is advertising: "..msg)
                  if ADKICK==1 then
                     SendPmToOps (BotName,"User has been kicked for Advertising.")
                     curUser:SendPM(BotName,"You were kicked for Advertising.")
                     curUser:TempBan()
                  else
                     curUser:SendPM(BotName,"Advertising Censored. Sorry.")
                  end
                  return 1
               end
            end
         end
         spam = 0
         if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
         spam=spam+1; end
         if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
            if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
         spam=spam+1;end; end
         if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
         spam=spam+1;end
         if spam>0 then
            s,e,msg = strfind(data, "%b<> (.*)")
            SendPmToOps (BotName,"Report: <"..curUser.sName.."> is advertising: "..msg)
            if ADKICK==1 then
               SendPmToOps (BotName,"User has been kicked for Advertising.")
               curUser:SendPM(BotName,"You were kicked for Advertising!")
               curUser:TempBan()
            else
               curUser:SendPM(BotName,"Advertising Censored. Sorry.")
            end
            return 1
         end
      end
      return MainCom(curUser,data)
   elseif strsub(data, 1, 5) == "$To: " then
      ToKickMsg(curUser, data)
      local s,e,to,from,text = strfind(data,    "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
      if to == BotName then
         return BotCom(curUser, data)
      else
         to = GetItemByName(to)
         if not curUser.bOperator then
            local _, _, msg = strfind(text, "^%b<>%s+(.*)|")
            if SiteCheck(msg)==1 then
               return 0
            else
               if Verify(curUser.sName, msg) then
                  local Lines = Verify(curUser.sName, msg)
                  tabAdvert = nil
                  tabAdvert = {}
                  local s,e, adver = strfind(Lines, "[^#]#(%S+)$")
                  if (FindAdver(adver) == "K") then
                  return 0
                  else
                     SendPmToOps (BotName,"Report: <"..curUser.sName.."> is advertising: "..msg)
                     if ADKICK==1 then
                        SendPmToOps (BotName,"User has been kicked for advertising.")
                        curUser:SendPM(BotName,"You were kicked for Advertising!")
                        curUser:TempBan()
                     else
                        curUser:SendPM(BotName,"Advertising Censored. Sorry.")
                     end
                     return 1
                  end
               end
            end
         end
         spam = 0
         if( strfind( strlower(data), "no",1,1) ) and ( strfind( strlower(data), "ip",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "my",1,1) ) and ( strfind( strlower(data), "ftp",1,1) ) then
            if ( strfind( strlower(data), "com",1,1) ) or ( strfind( strlower(data), "org",1,1) ) or ( strfind( strlower(data), "info",1,1) ) then
         spam=spam+1; end; end;
         if( strfind( strlower(data), "dns",1,1) ) and ( strfind( strlower(data), "2",1,1) ) and ( strfind( strlower(data), "go",1,1) ) then
         spam=spam+1; end
         if( strfind( strlower(data), "dy",1,1) ) and ( strfind( strlower(data), "nu",1,1) ) then
            if( strfind( strlower(data), ".net",1,1) ) or ( strfind( strlower(data), ".com",1,1) ) then
         spam=spam+1;end; end
         if( strfind( strlower(data), "d n s a",1,1) ) or ( strfind( strlower(data), "d n s .",1,1) ) or ( strfind( strlower(data), "d n s 2",1,1) ) or ( strfind( strlower(data), "o d s .",1,1) ) or ( strfind( strlower(data), "d y n",1,1) ) then
         spam=spam+1;end
         if spam>0 then
            s,e,msg = strfind(data, "%b<> (.*)")
            SendPmToOps (BotName,"Report: <"..curUser.sName.."> is advertising: "..msg)
            if ADKICK==1 then
               SendPmToOps (BotName,"User has been  kicked for advertising.")
               curUser:SendPM(BotName,"You were kicked for Advertising!")
               curUser:TempBan()
            else
               curUser:SendPM(BotName,"Advertising Censored. Sorry.")
            end
            return 1
         end
      end

   end
end


function MainCom(curUser,data)
   data=strsub(data,1,strlen(data)-1)
   local _,_,cmd = strfind(data, "%b<>%s+(%S+)")
   if not cmd then cmd = "0" end
   if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
      return 0
   else
      cmd = strlower(cmd)
      if strlen(cmd) > 1 then
         cmd=strsub(cmd,2,strlen(cmd))
         local SendCom = (Com(curUser,data,cmd))
         if not SendCom then
            return 1
         else
            return SendCom
         end
      end
   end
end

function BotCom(curUser, data)
   data=strsub(data,1,strlen(data)-1)
   _,_,cmd = strfind(data,"$%b<>%s+(%S+)")
   if not cmd then cmd = "0" end
   if (strsub(cmd, 1, 1) ~= Prefix1 and strsub(cmd, 1, 1) ~= Prefix2) then
      return 0
   else
      cmd = strlower(cmd)
      cmd=strsub(cmd,2,strlen(cmd))
      local SendCom = (Com(curUser,data,cmd))
      if not SendCom then
         return 1
      else
         return SendCom
      end
   end
end

function SiteCheck(msg)
   for value,index in SITES do
      if strfind(msg,index) then
         return 1
      end
   end
end

function FindAdver(adver)
   for v2,i2 in OKHUBS do
      if strfind(adver,v2) then
         return "K"
      end
   end
end


function Verify(userdata, msg)
   if not msg then return end
   tmp =""
   gsub(strlower(msg), "([a-?0-9.:%-])", function(x) tmp = tmp..x end)
   if not tabAdvert[userdata] then
      tabAdvert[userdata] = { iClock = clock(), l1 = "", l2 = "", l3 = "", l4= "", l5= "",l6= "",l7= "",l8= "",l9 = tmp}
   else
      tabAdvert[userdata].iClock = clock()
      tabAdvert[userdata].l1 = tabAdvert[userdata].l2
      tabAdvert[userdata].l2 = tabAdvert[userdata].l3
      tabAdvert[userdata].l3 = tabAdvert[userdata].l4
      tabAdvert[userdata].l4 = tabAdvert[userdata].l5
      tabAdvert[userdata].l5 = tabAdvert[userdata].l6
      tabAdvert[userdata].l6 = tabAdvert[userdata].l7
      tabAdvert[userdata].l7 = tabAdvert[userdata].l8
      tabAdvert[userdata].l8 = tabAdvert[userdata].l9
      tabAdvert[userdata].l9 = tmp
   end
   local Lines = tabAdvert[userdata].l1.."#"..tabAdvert[userdata].l2.."#"..tabAdvert[userdata].l3.."#"..tabAdvert[userdata].l4.."#"..tabAdvert[userdata].l5.."#"..tabAdvert[userdata].l6.."#"..tabAdvert[userdata].l7.."#"..tabAdvert[userdata].l8.."#"..tabAdvert[userdata].l9
   for value, key in ADVER do
      if (strfind(Lines, strlower(value), 1, 1)) then
         return Lines
      end
   end
end

function ToKickMsg(curUser, data)
   if strfind(data,"You are being kicked because:") then
      local _,_, Name,Op,Reason = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$<%S+> You are being kicked because:%s+(.*)|")
      OpCheck = GetItemByName(Op)
      if OpCheck~=nil and OpCheck.bOperator then
         vUser = GetItemByName(Name)
         if KicksRegVipOp(vUser,curUser)==0 then
            return 1
         end
         if vUser~=nil then
            SaveKickBanInfo(curUser.sName,vUser.sName,Reason,KickTable,KickFile, "KickTable")
         end
      end
   end
end

end

PtokaX forum

anti advertiser fix?
« on: 05 May, 2004, 19:25:43 »

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #1 on: 06 May, 2004, 10:38:36 »
my sneaky anti advertising filters those urls without any problem.

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 <----<<

Offline billop

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
(No subject)
« Reply #2 on: 09 May, 2004, 22:28:37 »
this word (come) it makes to leave the botadvertis..
for ---> com

and mistaken

(bad lang..)

PtokaX forum

(No subject)
« Reply #2 on: 09 May, 2004, 22:28:37 »