This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Tcl Ban-Spammer only for host

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simonetto
Voice
Posts: 11
Joined: Thu Mar 04, 2010 2:05 pm

Tcl Ban-Spammer only for host

Post by simonetto »

Hello. I Use the following tcl with satisfaction, but there is a point I would change: simply the way to ban.

Currently bans like this: *!*Tiscali@*.retail.telecomitalia.it

I would like to ban in that way: *!*@host221-206-dynamic.9-79-r.retail.telecomitalia.it
In short I want cha ban only the host.

I place the tcl, hoping you can help me.
Thanks in advance.
Simone

Code: Select all

# ban-spammers.tcl v1.0 by FireEgl@EFNet <FireEgl@LinuxFan.com> - 4-19-00

# Description:
# Bans anyone not known to the bot if they join a channel
# and the first thing they say contains a web link.
#
# It could be done better I guess..

# Words that it checks for:
set spamwords {
 http://
 www.
 .com
 .net
 .org
 .nu
 .ca
 .uk
 .edu
 .it
 {web page}
 site
}

# Time, in minutes that the ban will last:
# (43200 = 1 month)
set spambantime 43200

# Set Global ban (1), or Channel ban (2), or just a kick (3)?
set spambantype 1


bind join - * join:banspam
proc join:banspam {nick host hand chan} { global banspam
   if {![validuser $hand]} { set banspam($nick) 0 }
}

bind pubm - * pubm:banspam
proc pubm:banspam {nick host hand chan msg} { global banspam spamwords spambantime spambantype
   if {[info exists banspam($nick)]} {
      if {(([getchanidle $nick $chan] == 0) && ($banspam($nick) == 0))} {
         foreach s $spamwords {
            if {[lsearch -glob "$msg" "*$s*"] != -1} {
               switch $spambantype {
                  "1" { putserv "KICK $chan $nick :No Spam!"
                        newban [string trimleft [maskhost [getchanhost $nick $chan]] ~] Ban-Spam "$msg" $spambantime
                  }
                  "2" { putserv "KICK $chan $nick :No Spam!"
                        newchanban $chan [string trimleft [maskhost [getchanhost $nick $chan]] ~] Ban-Spam "$msg" $spambantime
                  }
                  "3" { puthelp "KICK $chan $nick :No Spam!" }
                  "default" { putlog "$nick@$chan Just spammed the channel with: $msg" }
               }
               break
            }
         }
      }
      unset banspam($nick)
   }
}


# unset the var when they leave:
bind kick - * kick:banspam
proc kick:banspam {nick host hand chan target reason} { global banspam
   catch { unset banspam($nick) }
}
bind part - * part:banspam
proc part:banspam {nick host hand chan {reason ""}} { global banspam
   catch { unset banspam($nick) }
}
bind sign - * sign:banspam
proc sign:banspam {nick host hand chan reason} { global banspam
   catch { unset banspam($nick) }
}
bind splt - * splt:banspam
proc splt:banspam {nick host hand chan} { global banspam
   catch { unset banspam($nick) }
}

putlog "\002Ban-Spammers.tcl\002 v 1.0 by FireEgl@EFNet caricata con successo!"
Simonetto
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Enjoy :)

Code: Select all

# ban-spammers.tcl v1.0 by FireEgl@EFNet <FireEgl@LinuxFan.com> - 4-19-00

# Description:
# Bans anyone not known to the bot if they join a channel
# and the first thing they say contains a web link.
#
# It could be done better I guess..

# Words that it checks for:
set spamwords {
 http://
 www.
 .com
 .net
 .org
 .nu
 .ca
 .uk
 .edu
 .it
 {web page}
 site
}

# Time, in minutes that the ban will last:
# (43200 = 1 month)
set spambantime 43200

# Set Global ban (1), or Channel ban (2), or just a kick (3)?
set spambantype 1


bind join - * join:banspam
proc join:banspam {nick host hand chan} { global banspam
   if {![validuser $hand]} { set banspam($nick) 0 }
}

bind pubm - * pubm:banspam
proc pubm:banspam {nick host hand chan msg} { global banspam spamwords spambantime spambantype
   if {[info exists banspam($nick)]} {
      if {(([getchanidle $nick $chan] == 0) && ($banspam($nick) == 0))} {
         foreach s $spamwords {
            if {[lsearch -glob "$msg" "*$s*"] != -1} {
              set host [getchanhost $nick $chan]
               switch $spambantype {
                  "1" { putserv "KICK $chan $nick :No Spam!"
                        newban *!*@[lrange [split $host @] 1 end] Ban-Spam "$msg" $spambantime
                  }
                  "2" { putserv "KICK $chan $nick :No Spam!"
                        newchanban $chan  *!*@[lrange [split $host @] 1 end]  Ban-Spam "$msg" $spambantime
                  }
                  "3" { puthelp "KICK $chan $nick :No Spam!" }
                  "default" { putlog "$nick@$chan Just spammed the channel with: $msg" }
               }
               break
            }
         }
      }
      unset banspam($nick)
   }
}
s
simonetto
Voice
Posts: 11
Joined: Thu Mar 04, 2010 2:05 pm

Post by simonetto »

Thank you.
I just tried and it works wonderfully.
Thank you very much really :-)
Simonetto
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

You're very welcome. :)
s
simonetto
Voice
Posts: 11
Joined: Thu Mar 04, 2010 2:05 pm

Post by simonetto »

Hello. The script is good but I would improve it even more to my needs.

You can do so that I can decide on which chan enable it?
I hope this is possible. Thanks :)
Simonetto
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

A simple 'setudef flag spamwords' and

Code: Select all

if {![channel get $chan spamwords]} return
at join and pubm processes, then '.chanset #channel +spamwords' from party-line should do the trick.

PS: You can replace 'spamwords' with whatever you wish, as long as isn't already used. But if you do want to use an existing channel flag then don't add the 'setudef' part.
Once the game is over, the king and the pawn go back in the same box.
s
simonetto
Voice
Posts: 11
Joined: Thu Mar 04, 2010 2:05 pm

Post by simonetto »

ah thanks, but what position I put the string?
Simonetto
s
simonetto
Voice
Posts: 11
Joined: Thu Mar 04, 2010 2:05 pm

Post by simonetto »

no, I do not work :(
Simonetto
s
simonetto
Voice
Posts: 11
Joined: Thu Mar 04, 2010 2:05 pm

Post by simonetto »

Nobody can help me? :(
Simonetto
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Re: Tcl Ban-Spammer only for host

Post by Luminous »

Code: Select all

bind join - * join:banspam
proc join:banspam {nick host hand chan} { 
 setudef flag spamwords
 if {![channel get $chan +spamwords]} {return}
          <snip>
}

bind pubm - * pubm:banspan
proc pubm:banspam {nick host hand chan text} {
 setudef flag spamwords
 if {![channel get $chan +spamwords]} {return}
          <snip>

Post Reply