Top

Spam Relay (two bots required)


TCL Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Nov 12, 2009
Last Updated  Nov 12, 2009
Tags  ban  bot  deop  op  spam 

Introduction

This is a DALnet specific script designed to be run on two eggdrops.
An OP'd bot, a DeOP'd bot.

The OP bot monitors messages from the deop bot, should anyone spam it.

The settings are currently set for the DeOP'd bot to cycle every 5mins.

Both spamcheck and docycle are easily enabled/disabled.

Check scripts for syntax.

Grab the Code

# Load this TCL to your @/OPd Channel Bot.
 
# You need to add a custom flag to recognise the deop/relay bot.
# Firstly, add the bot to your @/OPd bot - dcc/ctcp/partyline - .+user relay *!*bots@host.mask
# Secondly, you need to add the flag - .chattr relay -|A #channel <- this will then allow the bot access to the below command.
 
bind msg - spam spam:ban
proc spam:ban {nick uhost hand arg} {
  set bchan [strlwr [lindex $arg 0]]
  if {[matchattr $hand -|A $bchan]} {
    set spamnick [join [lindex [split $arg] 1]]
    set bmask *!*@[lindex [split [getchanhost $spamnick $bchan] @] 1]
    set breason "Spamming/Advertising in a channel you \002DONT\002 have access to is against this Networks AUP (\002\037A\037\002cceptable \002\037U\037\002se \002\037P\037\002olicy)"
    set bnotice "For more information about the \037DALNet AUP\037 (\002\037A\037\002cceptable \002\037U\037\002se \002\037P\037\002olicy) please visit: http://www.dal.net/aup/"
    putquick "MODE $bchan +b $bmask"
    putquick "KICK $bchan $spamnick :$breason"
    putserv "PRIVMSG $spamnick :$bnotice"
  }
}
 
putlog "LOADED: OP Relay - .:Spam:Checker:."
 
 
# -----------BREAK--------------
 
 
# Load this TCL to your deOPd channel bot.
 
# Spam List: Edit this with whatever strings you want to match/ban.
set spamwords {  
  "*http://*" 
  "*www.*"
  "*.com*"
  "*.net*"
  "*.org*"
  "*.biz*"
  "*.info*"
  "*.name*"
  "*decode*"
  "*#*"
  "*irc.*"
}
 
# Public Trigger (feel free to change to whatever you like).
set pubtrig !
 
# Cycle Time: measured in minutes.
set cycletime 5
 
# Obviously the nickname of the @/OPd bot.
set oppedbot "opbotnick"
 
setudef flag spamcheck
setudef flag docycle
 
# Trigger set to !
# Public Command
# Syntax: !spamcheck on/off
bind pub - ${pubtrig}spamcheck chanset:spamcheck
proc chanset:spamcheck {nick uhost hand chan text} {
  global botnick
  if {[matchattr $hand o|m $chan]} {
 
    if {[lindex $text 0] == "on"} {
      channel set $chan +spamcheck
      puthelp "PRIVMSG $chan :Enabled Relay Spam Protection for $chan"
    }
 
    if {[lindex $text 0] == "off"} {
      channel set $chan -spamcheck
      puthelp "PRIVMSG $chan :Disabled Relay Spam Protection for $chan"
    }
  }
}
 
# Private Command
# Syntax: /msg botnick spamcheck #channelname on/off
bind msg - spamcheck spam:msg
proc spam:msg {nick uhost hand arg} {
  set chan [strlwr [lindex $arg 0]]
  if {[matchattr $hand o|m $chan]} {
 
    if {[lindex $arg 1] == "on"} {
      channel set $chan +spamcheck
      putquick "NOTICE $nick :Enabled Relay Spam Protection for $chan"
    }
 
    if {[lindex $arg 1] == "off"} {
      channel set $chan -spamcheck
      putquick "NOTICE $nick :Disabled Relay Spam Protection for $chan"
    }
  }
}
 
# Trigger set to !
# Public Command
# Syntax: !chancycle on/off
bind pub - ${pubtrig}chancycle do:cycle:pub
proc do:cycle:pub {nick uhost hand chan text} {
  global botnick
  if {[matchattr $hand o|m $chan]} {
 
    if {[lindex $text 0] == "on"} {
      channel set $chan +docycle
      puthelp "PRIVMSG $chan :Enabled Channel Cycle for $chan"
    }
 
    if {[lindex $text 0] == "off"} {
      channel set $chan -docycle
      puthelp "PRIVMSG $chan :Disabled Channel Cycle for $chan"
    }
  }
}
 
# Private Command
# Syntax: /msg botnick chancycle #channelname on/off
bind msg - chancycle do:cycle:msg
proc do:cycle:msg {nick uhost hand arg} {
  set chan [strlwr [lindex $arg 0]]
  if {[matchattr $hand o|m $chan]} {
 
    if {[lindex $arg 1] == "on"} {
      channel set $chan +docycle
      putquick "NOTICE $nick :Enabled Channel Cycle for $chan"
    }
 
    if {[lindex $arg 1] == "off"} {
      channel set $chan -docycle
      putquick "NOTICE $nick :Disabled Channel Cycle for $chan"
    }
  }
}
 
timer $cycletime cycle
proc cycle {} {
  global cycletime
  foreach c [channels] {
    if {[lsearch -exact [channel info $c] +docycle] != -1} {
      putserv "PART $c"; timer $cycletime cycle
    }
  }
}
 
bind pubm - * pub:spam:check
proc pub:spam:check {nick uhost hand chan text} {
  global spamwords oppedbot
  if {[lsearch -exact [channel info $chan] +spamcheck] != -1} {
    foreach pattern $spamwords {
      if {[string match -nocase $pattern $text]} {
        if {(![validuser $hand]) && (![isop $nick $chan]) && (![isvoice $nick $chan])} {
          putquick "PRIVMSG $oppedbot :spam $chan $nick"
        }
      }
    }
  }
  return 0
}
 
bind msgm - * msg:spam:check
proc msg:spam:check {nick uhost hand text} { 
  global spamwords oppedbot
  foreach nospamchan [channels] {
    if {[lsearch -exact [channel info $nospamchan] +spamcheck] != -1} {
      if {([botisop $nospamchan]) && (![isbotnick $nick])} { 
        if {([onchan $nick $nospamchan]) && (![validuser $hand]) && (![isop $nick $nospamchan]) && (![isvoice $nick $nospamchan])} {
          foreach pattern $spamwords {
            if {[string match -nocase $pattern $text]} {
              putquick "PRIVMSG $oppedbot :spam $nospamchan $nick" 
            }
          }
        }
      }
    } 
  } 
  return 0
}
 
bind CTCP - ACTION spam:check
proc spam:check {nick uhost hand dest key text} {
  global botnick spamwords 
  set chan $dest
  foreach nospamchan [channels] {
    if {[lsearch -exact [channel info $chan] +spamcheck] != -1} {
      if {([botisop $nospamchan]) && (![isbotnick $nick])} {
        if {![validuser $hand]} {
          if {([onchan $nick $nospamchan]) && (![isop $nick $nospamchan]) && (![isvoice $nick $nospamchan])} {
            foreach pattern $spamwords {
              if {[string match -nocase $pattern $text]} { 
                putquick "PRIVMSG $oppedbot :spam $nospamchan $nick"
              }
            }
          }
        }
      } 
    } 
  }
  return 0
}
 
putlog "LOADED: DeOP Relay - .:Spam:Checker:."

Comments

  (2)  RSS
Cracker200
Comments: 257
 
TCL Snippet:  Spam Relay (two bots required)
Posted on Nov 13, 2009 1:04 pm
Nice. I like, it i don't know about any one else but i find it handy...

Al tho you could, do it so You Query, the bot, and it does the commands not in a Main, room Because then they'd know you have a Mole :O
Get_A_Fix
Comments: 18
 
TCL Snippet:  Spam Relay (two bots required)
Posted on Nov 15, 2009 5:55 am
This was taken from another script I posted - http://www.hawkee.com/snippet/3853/

NOTE: This code is only to be used in conjunction with the above script. It requires the global variable pubtrig to set trigger for command.


Code:

setudef flag ojcheck

# The 'mnobf' flags below stop global users who are added to the bot from being messaged.
# The 'mnof' flags below that are channel users who are added.
# This means you will NOT get a message, so don't cycle the channel expecting one. Normal Users will get it.
set ojglobflags mnobf
set ojchanflags mnof

bind JOIN - * onjoin:notice

# Public Command
# Syntax: !onjoin on/off
bind pub - ${pubtrig}onjoin onjoin:pub
proc onjoin:pub {nick uhost hand chan text} {
  global botnick
  if {[matchattr $hand o]} {
 
    if {[lindex $text 0] == "on"} {
      channel set $chan +ojcheck
      puthelp "PRIVMSG $chan :Enabled Onjoin Message Check for $chan"
    }
 
    if {[lindex $text 0] == "off"} {
      channel set $chan -ojcheck
      puthelp "PRIVMSG $chan :Disabled Onjoin Message Check for $chan"
    }
  }
}

# Private Command
# Syntax: /msg botnick onjoin #channelname on/off
bind msg - onjoin onjoin:msg
proc onjoin:msg {nick uhost hand arg} {
  set chan [strlwr [lindex $arg 0]]
  if {[matchattr $hand o|m $chan]} {
 
    if {[lindex $arg 1] == "on"} {
      channel set $chan +ojcheck
      putquick "NOTICE $nick :Enabled Onjoin Message Check for $chan"
    }
 
    if {[lindex $arg 1] == "off"} {
      channel set $chan -ojcheck
      putquick "NOTICE $nick :Disabled Onjoin Message Check for $chan"
    }
  }
}

proc onjoin:notice {nick uhost hand chan} {
  global ojglobflags ojchanflags
  if {[lsearch -exact [channel info $chan] +ojcheck] != -1} {
    if {![isbotnick $nick]} {
      if {![matchattr $hand $ojglobflags|$ojchanflags $chan]} {
        putserv "PRIVMSG $nick :Hello $nick"
        putserv "PRIVMSG $nick :I am checking for Infected/SPAM clients/bots!"
        putserv "PRIVMSG $nick :Please do \002NOT\002 Reply to this Message."
      }
    }
  }
  return 0
}


In the above code I opted to use 3 lines sent from the bot. This can be problematic in large channels, even more so on ones that are affected by constant netsplits.

The logic behind this is simple. Spam drones generally send between 1-3 strings of normal
text before they actually spam.

ie: hi, hw r u (drone)
ie: I am fine, you? (user)
ie: asl? (drone)
ie: what? (user)
ie: For hard sex and lots of ........ visit ....... SPAM!!!!!!!!!!! (drone)

Atleast, I've had this happen a lot with various networks, it seems that sending 3 lines of text always triggers some form of spam result. If it doesn't, they may be clean, but it doesn't always work :(

Anyway, thanks for the comment Cracker200, I hope the above code helps.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom