| View previous topic :: View next topic |
| Author |
Message |
simonetto Voice
Joined: 04 Mar 2010 Posts: 11
|
Posted: Tue Aug 24, 2010 12:34 am Post subject: Tcl Ban-Spammer only for host |
|
|
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: | # 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 |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Tue Aug 24, 2010 1:30 pm Post subject: |
|
|
Enjoy
| Code: |
# 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)
}
}
|
|
|
| Back to top |
|
 |
simonetto Voice
Joined: 04 Mar 2010 Posts: 11
|
Posted: Tue Aug 24, 2010 2:01 pm Post subject: |
|
|
Thank you.
I just tried and it works wonderfully.
Thank you very much really  _________________ Simonetto |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Tue Aug 24, 2010 6:27 pm Post subject: |
|
|
You're very welcome.  |
|
| Back to top |
|
 |
simonetto Voice
Joined: 04 Mar 2010 Posts: 11
|
Posted: Tue Sep 07, 2010 10:27 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Sep 07, 2010 11:03 am Post subject: |
|
|
A simple 'setudef flag spamwords' and
| Code: |
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. |
|
| Back to top |
|
 |
simonetto Voice
Joined: 04 Mar 2010 Posts: 11
|
Posted: Tue Sep 07, 2010 11:27 am Post subject: |
|
|
ah thanks, but what position I put the string? _________________ Simonetto |
|
| Back to top |
|
 |
simonetto Voice
Joined: 04 Mar 2010 Posts: 11
|
Posted: Wed Sep 08, 2010 12:05 pm Post subject: |
|
|
no, I do not work  _________________ Simonetto |
|
| Back to top |
|
 |
simonetto Voice
Joined: 04 Mar 2010 Posts: 11
|
Posted: Wed Sep 15, 2010 6:39 pm Post subject: |
|
|
Nobody can help me?  _________________ Simonetto |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Fri Sep 17, 2010 9:52 am Post subject: Re: Tcl Ban-Spammer only for host |
|
|
| Code: |
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>
|
|
|
| Back to top |
|
 |
|