| View previous topic :: View next topic |
| Author |
Message |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Thu Jan 18, 2007 9:56 am Post subject: Add ban after 1-2 kicks? |
|
|
| Code: | ####################################################################
# #
# Based on BadWord.tcl by TheGhost and/or Rajeh Alharithi #
# #
# Stripped out most of the original, for basic kick on 'bad' words #
# #
# #
# Cobratek #
####################################################################
## The bad word list
bind pubm - "!list" badword
bind pub - "!list" badword
bind pubm - "@find" badword
bind pub - "@find" badword
bind pub - "!find" badword
bind pubm - "!find" badword
## Main script
proc badword {nick uhost hand chan rest} {
global botnick bword
if {([ matchattr $hand f ])} {
putserv "PRIVMSG $chan : $nick >:-| "
return 1
} else {
putserv "KICK $chan $nick : There are NO files here, and this is not a warez server."
return 0
}
}
putlog "!list kicker v0.1 loaded"
|
How do I add a "ban" after either 1 or two kicks for the same offence? and Time it?
Thanks fellas. |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Thu Jan 18, 2007 11:50 am Post subject: |
|
|
That script seems rather buggy/crap in many ways, obv. made by some newbie by the looks of it.
Try this:
| Code: | set badwords(chans) "#chan1 #chan2"
set badwords(excempt) "f|f"
set badwords(words) {
"!find"
"@find"
"!list"
"@list"
}
set badwords(banon) "2"; # 1 = on first instance, 2 = on second instance etc
set badwords(bantime) "2"; # in minutes
set badwords(kickmsg) "Badword found!"
bind pubm - {*} pub:badwords
proc pub:badwords {nick host hand chan text} {
global badwords
if {[lsearch -exact "$badwords(chans)" $chan] == -1} { return }
if {[matchattr $hand $badwords(excempt) $chan]} { return }
set bword 0
foreach word $text {
if {$word == ""} { return }
if {[lsearch -exact "$badwords(words)" $word] != -1} {
set bword 1
break
}
}
if {$bword} {
if {![info exists badwords($chan:$host)]} {
set badwords($chan:$host) "1"
} else {
incr badwords($chan:$host) 1
}
if {$badwords($chan:$host) >= $badwords(banon)} {
putserv "MODE $chan +b $host"
putserv "KICK $chan $nick :$badwords(kickmsg)"
newchanban $chan $host $nick "$badwords(kickmsg)" $badwords(bantime)
utimer [expr {$badwords(bantime)*60}] [list unset badwords($chan:$host)]
} else {
putserv "KICK $chan $nick :$badwords(kickmsg)"
}
}
} |
NOT TESTED!! _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Thu Jan 18, 2007 12:04 pm Post subject: |
|
|
It works, but the ban is incorrect. The user can rejoin...
| Code: |
[11:03am] * ExCuRSion sets mode: +b *!DJmart@elite-FF83EB81.dyn.optonline.net |
|
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Thu Jan 18, 2007 12:38 pm Post subject: |
|
|
After the line:
| Code: | | if {$badwords($chan:$host) >= $badwords(banon)} { |
Put:
| Code: | | set host *!*@[lindex [split $host @] 1] |
It will then ban *!*@some.host.com _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Thu Jan 18, 2007 1:33 pm Post subject: |
|
|
| Code: | [12:32pm] * Xeon sets mode: +o ExCuRSion
[12:32pm] * ExCuRSion sets mode: +b *!*@elite-FF83EB81.dyn.optonline.net
[12:32pm] * You were kicked by ExCuRSion (Banned: Badword found!)
[12:32pm] * Attempting to rejoin channel #phatlogic
[12:32pm] * Now talking in #phatlogic |
Oh no!
Its still not working correctly... any idea?
Its not banning the correct host/IP |
|
| Back to top |
|
 |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Thu Jan 18, 2007 9:03 pm Post subject: |
|
|
i realized the "split" is incorrect. it says "elite" insted of "irc"
not sure how to fix that either  |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri Jan 19, 2007 10:03 am Post subject: |
|
|
It will ban *!ident@host.com if the host has phatlogic.com in it, else it will ban *!ident@*.rest.of.host.com
EDIT: Fixed banmask to actually ban *!ident@*.rest.of.host.com
| Code: | set badwords(chans) "#chan1 #chan2"
set badwords(excempt) "f|f"
set badwords(words) {
"!find"
"@find"
"!list"
"@list"
}
set badwords(banon) "2"; # 1 = on first instance, 2 = on second instance etc
set badwords(bantime) "2"; # in minutes
set badwords(kickmsg) "Badword found!"
bind pubm - {*} pub:badwords
proc pub:badwords {nick host hand chan text} {
global badwords
if {[lsearch -exact "$badwords(chans)" $chan] == -1} { return }
if {[matchattr $hand $badwords(excempt) $chan]} { return }
set bword 0
foreach word $text {
if {$word == ""} { return }
if {[lsearch -exact "$badwords(words)" $word] != -1} {
set bword 1
break
}
}
if {$bword} {
if {![info exists badwords($chan:$host)]} {
set badwords($chan:$host) "1"
} else {
incr badwords($chan:$host) 1
}
if {$badwords($chan:$host) >= $badwords(banon)} {
if {[string match -nocase *phatlogic.com $host]} {
set host *!$host
} else {
set host [lindex [split $host @] 0]@*.[join [lrange [split [lindex [split $host @] 1] .] end-[expr [llength [split [lindex [split $host @] 1] .]] - 2] end] .]
}
putserv "MODE $chan +b $host"
putserv "KICK $chan $nick :$badwords(kickmsg)"
newchanban $chan $host $nick "$badwords(kickmsg)" $badwords(bantime)
utimer [expr {$badwords(bantime)*60}] [list unset badwords($chan:$host)]
} else {
putserv "KICK $chan $nick :$badwords(kickmsg)"
}
}
} |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Jan 19, 2007 10:46 am Post subject: |
|
|
Eggdrop doesn't invent host names. If it's banning the wrong host, the irc server must be lying to it.
.jump to a better network. _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri Jan 19, 2007 11:35 am Post subject: |
|
|
User:
The irc network changes the host for 'privacy' and so the only option is to ban via ident or *!ident@*.end.of.host.com
Tosser@irc-C01B49CA.asfd.broadband.ntl.com -> Tosser@*.asfd.broadband.ntl.com _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
DJmart Voice
Joined: 08 Mar 2006 Posts: 21
|
Posted: Fri Jan 19, 2007 11:47 am Post subject: |
|
|
Its working correctly with the bans but I see this in the status window when the ban is to expire:
| Code: | [10:45am] <ExCuRSion> [10:45] Tcl error in script for 'timer1286':
[10:45am] <ExCuRSion> [10:45] can't unset "badwords(#phatlogic:DJmart@*.dyn.optonline.net)": no such element in array |
|
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri Jan 19, 2007 11:57 am Post subject: |
|
|
Use:
| Code: | set badwords(chans) "#chan1 #chan2"
set badwords(excempt) "f|f"
set badwords(words) {
"!find"
"@find"
"!list"
"@list"
}
set badwords(banon) "2"; # 1 = on first instance, 2 = on second instance etc
set badwords(bantime) "2"; # in minutes
set badwords(kickmsg) "Badword found!"
bind pubm - {*} pub:badwords
proc pub:badwords {nick host hand chan text} {
global badwords
if {[lsearch -exact "$badwords(chans)" $chan] == -1} { return }
if {[matchattr $hand $badwords(excempt) $chan]} { return }
set bword 0
foreach word $text {
if {$word == ""} { return }
if {[lsearch -exact "$badwords(words)" $word] != -1} {
set bword 1
break
}
}
if {$bword} {
if {![info exists badwords($chan:$host)]} {
set badwords($chan:$host) "1"
} else {
incr badwords($chan:$host) 1
}
if {$badwords($chan:$host) >= $badwords(banon)} {
utimer [expr {$badwords(bantime)*60}] [list unset badwords($chan:$host)]
if {[string match -nocase *phatlogic.com $host]} {
set host *!$host
} else {
set host [lindex [split $host @] 0]@*.[join [lrange [split [lindex [split $host @] 1] .] end-[expr [llength [split [lindex [split $host @] 1] .]] - 2] end] .]
}
putserv "MODE $chan +b $host"
putserv "KICK $chan $nick :$badwords(kickmsg)"
newchanban $chan $host $nick "$badwords(kickmsg)" $badwords(bantime)
} else {
putserv "KICK $chan $nick :$badwords(kickmsg)"
}
}
} |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
|