# badrealname.tcl
# original code by Papillon
# modified and adjusted by caesar
# version 1.4
# http://www.r0x0ring.com/
###
# Description:
#
# Performs a whois on join and places a *!*@host ban if mathes a banned realname.
###
## Notes:
#
# I've noticed something fishy at it and decided to have a look. I've spoted a problem wich was successfuly fixed.
# Also, many thanks to ppslim for the ctrl:filter proc. Thank you! :)
# What bad realnames should be banned?
set badr(list) {
"realname proibido1"
"realname proibido2"
}
# The realname check should be done only in what channel?
set badr(chan) "#canal"
# For how many minutes whould you like the ban?
set badr(time) 60
# What reason will be used when an person is found using an bad realname?
set badr(reason) "razao..."
#
###
#### Don't edit past here unless you know TCL!
###
#
##
# binds
bind join - "$badr(chan) *" brealname:join
bind raw - 311 brealname:check
##
# join
proc brealname:join {nick host hand chan} {
if {[strlwr $nick] == [strlwr $::botnick] || [matchattr $hand of|fo $chan]} {
return
}
putserv "WHOIS $nick"
}
##
# check
proc brealname:check {from key arg} {
set realname [strlwr [ctrl:filter [lindex [lrange [split $arg ":"] 1 end] 0]]]
foreach bla $::badr(list) {
if {![string match -nocase $bla $realname]} {
continue
}
newchanban $::badr(chan) "*!*@[lindex [split $arg] 3]" $::botnick $::badr(reason) $::badr(time)
break
}
}
##
# ppslim's filter
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}
putlog "badrealname.tcl.. loaded."
-----------------------------------------------------------------------------
[14:25] <teste> [15:27] Tcl error [brealname:join]: invalid command name "strlwr"
[14:25] <teste> [15:27] Tcl error [brealname:check]: invalid command name "strlwr"
[14:25] <teste> [15:27] Tcl error [brealname:check]: invalid command name "strlwr"
[14:25] <teste> [15:27] Tcl error [brealname:check]: invalid command name "strlwr"
--------------------------------------------------------------------------------
[14:30] <made_of_storm> .set errorInfo
[14:30] <teste> [15:32] tcl: builtin dcc call: *dcc:set made_of_storm 9 errorInfo
[14:30] <teste> [15:32] #made_of_storm# set errorInfo
[14:30] <teste> Currently: invalid command name "strlwr"
[14:30] <teste> Currently: while executing
[14:30] <teste> Currently: "strlwr [ctrl:filter [lindex [lrange [split $arg ":"] 1 end] 0]]"
[14:30] <teste> Currently: (procedure "brealname:check" line 2)
[14:30] <teste> Currently: invoked from within
[14:30] <teste> Currently: "brealname:check $_raw1 $_raw2 $_raw3"
where did you find "strlwr"? did you make it up or something?
I believe you wanted to do use "string tolower <string>".
i strongly advise you to visit this page: http://www.tcl.tk/man/tcl8.4/TclCmd/
Btw. in [lindex ... 0] you were probably looking for join rather than lindex, werent you? the lindex ... 0 would break your lrange ... 1 end totally and would reduce it so an lindex ... 1 ^^
lol, i only checked the compat.tcl @_o. Such stupid things always anoy me, I don't like the idea of using a function as a makro so I try to use real TCL functions provided by eggdrop or tcl itself ^^.
nope, the script uses ::badr, so global badr is just redudant (and might even cause problems).
I recently steped over http://www.tcl.tk/man/tcl8.4/TclCmd/namespace.htm . I never really new why it worked, but I guess ::var refers to var in namespace "" (emtpy string) which should be the global namespace.
Namespaces have nonempty names except for the global namespace.
ppl this scripts (badrealname, nslookup and ping) was extracted of the forum I didn't go I that created it just installed I tested and I placed the mistake in the forum
why don't you bother to check it yourself or post the mistake to these people they made them? I am sure you simply didn't copy all of it (or like in this case, didn't load all required tcls ^^).
Remember guys this forum has lost a shed load of posts. Maybe the solution / final code was lost. Just a thought
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
## ¤ BadRealname Description:
# Performs a whois on join and places a *!*@host ban if mathes a banned realname.
## ¤ Available commands:
# Where Flag Command Description
# ----- ---- ------- -----------
# PUB : N/A
# MSG : N/A
# DCC : n|n .chanset Use .chanset to set what protections to active for the particular channel or not.
# Example: .chanset #mychan +brealname
# .chanset #otherchan -brealname
## ¤ Custom channel flags:
#
# Flag: Description:
# ----- ------------
# +brealname Channels marked with this flag will be "checked" for bad realnames on join.
##
# Adjust the folowing things to suit your needs!
# .1. What bad realnames should be banned?
set badr(list) {
"foo bar"
"bla bla"
"*moo*"
"???"
"*http://*"
"*www.*"
}
# .2. For how many minutes whould you like the ban?
set badr(time) 60
# .3. What reason will be used when an person is found using an bad realname?
set badr(reason) "You norteh norteh boy!"
# .4. Protection settings joins/seconds against a join flood:
set badr(flud) "3:5"
#
## ¤ Don't edit past here unless you know TCL! ¤
#
set badr(version) "1.5"
setudef flag brealname
##
# binds
bind join * * brealname:join
bind part - * brealname:part
bind raw - 311 brealname:check
##
# join
proc brealname:join {nick host hand chan} {
global bflud badr
if {![channel get $chan brealname] || [isbotnick $nick ] || [matchattr $hand of|fo $chan] || ![botisop $chan]} {
return
}
if {![info exists bflud($chan)]} {
set bflud($chan) 0
}
set bla [split $badr(flud) ":"]
set nojoins [lindex $bla 0]
set insec [lindex $bla 1]
incr bflud($chan)
utimer $insec [list brealname:reset $chan]
if {$bflud($chan) <= $nojoins} {
putserv "WHOIS $nick"
}
}
##
# check
proc brealname:check {from key txt} {
global badr botnick
set realname [ctrl:filter [string range [join [lrange [split $txt] 5 end]] 1 end]]
foreach bla $badr(list) {
if {![string match -nocase $bla $realname]} {
continue
}
if {$badr(time) == ""} {
set badr(time) [channel get $badr(chan) ban-time]
}
newchanban $badr(chan) "*!*@[lindex [split $txt] 3]" $botnick $badr(reason) $badr(time)
break
}
}
##
# ppslim's filter
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}
##
# reset
proc brealname:reset {chan} {
global bflud
incr bflud($chan) -1
return
}
##
# array remove
proc brealname:part {nick uhost hand chan msg} {
global bflud
if {![isbotnick $nick]} {
return
}
foreach arr_part [array names bflud] {
if {[string match $chan $arr_part]} {
array unset bflud $chan
}
}
}
I'm an idiot, At least this one [bug] took about 5 minutes to find...
That old version uses some procs from alltools.tcl (if I'm not mistaken), a new version, with a different name BadWhois is on it's way to the TCL Archive or from here but not for long..
Once the game is over, the king and the pawn go back in the same box.