anti advertiser fix?
 

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

anti advertiser fix?

Started by jiten, 05 May, 2004, 19:25:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jiten

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

plop

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

billop

this word (come) it makes to leave the botadvertis..
for ---> com

and mistaken

(bad lang..)

SMF spam blocked by CleanTalk