| View previous topic :: View next topic |
| Author |
Message |
jsilvestre Voice

Joined: 05 Mar 2005 Posts: 20 Location: Lisbon, Portugal
|
Posted: Tue Apr 12, 2005 9:31 am Post subject: badrealname bug |
|
|
| Code: |
# 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"
|
_________________ Best Regards
José Eduardo Silvestre |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Tue Apr 12, 2005 10:09 am Post subject: |
|
|
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 ^^ _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
greenbear Owner
Joined: 24 Sep 2001 Posts: 733 Location: Norway
|
Posted: Tue Apr 12, 2005 12:41 pm Post subject: |
|
|
| strlwr is part of alltools.tcl |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Apr 12, 2005 12:48 pm Post subject: |
|
|
Or use alltools.tcl since it has the strlwr proc that shortcuts 'string tolower'
Edit: gb beat me to it _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Tue Apr 12, 2005 2:44 pm Post subject: |
|
|
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 ^^. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Linux Halfop

Joined: 04 Apr 2004 Posts: 71 Location: Under The Sky
|
Posted: Tue Apr 12, 2005 9:42 pm Post subject: |
|
|
is this the missing part ?!?  _________________ I'm an idiot, At least this one [bug] took about 5 minutes to find... |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Wed Apr 13, 2005 5:10 am Post subject: |
|
|
| Linux wrote: |
is this the missing part ?!?  |
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.
| Quote: | | Namespaces have nonempty names except for the global namespace. |
_________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
jsilvestre Voice

Joined: 05 Mar 2005 Posts: 20 Location: Lisbon, Portugal
|
Posted: Wed Apr 13, 2005 5:30 am Post subject: |
|
|
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  _________________ Best Regards
José Eduardo Silvestre |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Wed Apr 13, 2005 5:59 am Post subject: |
|
|
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 ^^). _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Linux Halfop

Joined: 04 Apr 2004 Posts: 71 Location: Under The Sky
|
Posted: Wed Apr 13, 2005 6:06 am Post subject: |
|
|
| Quote: | # badrealname.tcl
# original code by Papillon
# modified and adjusted by caesar |
i dont think so.. that these peoples do such a mistake, might he do some changes... i guess  _________________ I'm an idiot, At least this one [bug] took about 5 minutes to find... |
|
| Back to top |
|
 |
^DooM^ Owner

Joined: 26 Aug 2003 Posts: 772 Location: IronForge
|
Posted: Wed Apr 13, 2005 6:11 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Linux Halfop

Joined: 04 Apr 2004 Posts: 71 Location: Under The Sky
|
Posted: Wed Apr 13, 2005 6:12 am Post subject: |
|
|
Humans && Mistakes = Possible
| Code: | ## ¤ 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... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Apr 15, 2005 4:42 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Volume Halfop
Joined: 23 May 2003 Posts: 84
|
Posted: Fri Jul 22, 2005 2:10 pm Post subject: tcl error |
|
|
Tcl error [badwhois:check]: invalid command name "stripcodes"
what is the problem?
## ¤ BadWhois
# version 0.1 |
|
| Back to top |
|
 |
|