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.

badrealname bug

Support & discussion of released scripts, and announcements of new releases.
User avatar
jsilvestre
Voice
Posts: 20
Joined: Sat Mar 05, 2005 6:02 am
Location: Lisbon, Portugal

badrealname bug

Post by jsilvestre »

Code: Select all

# 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
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

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...
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

strlwr is part of alltools.tcl
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Or use alltools.tcl since it has the strlwr proc that shortcuts 'string tolower'

Edit: gb beat me to it
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

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...
User avatar
Linux
Halfop
Posts: 71
Joined: Sun Apr 04, 2004 4:20 pm
Location: Under The Sky

Post by Linux »

Code: Select all

global badr
is this the missing part ?!? :roll:
I'm an idiot, At least this one [bug] took about 5 minutes to find...
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Linux wrote:

Code: Select all

global badr
is this the missing part ?!? :roll:
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.
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...
User avatar
jsilvestre
Voice
Posts: 20
Joined: Sat Mar 05, 2005 6:02 am
Location: Lisbon, Portugal

Post by jsilvestre »

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 :D
Best Regards

José Eduardo Silvestre
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

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...
User avatar
Linux
Halfop
Posts: 71
Joined: Sun Apr 04, 2004 4:20 pm
Location: Under The Sky

Post by Linux »

# 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 :shock:
I'm an idiot, At least this one [bug] took about 5 minutes to find...
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

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
User avatar
Linux
Halfop
Posts: 71
Joined: Sun Apr 04, 2004 4:20 pm
Location: Under The Sky

Post by Linux »

Humans && Mistakes = Possible :lol:

Code: Select all

## ¤ 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...
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

The complete script can be found at www.r0x0ring.com
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
V
Volume
Halfop
Posts: 84
Joined: Fri May 23, 2003 5:08 am

tcl error

Post by Volume »

Tcl error [badwhois:check]: invalid command name "stripcodes"

what is the problem?

## ¤ BadWhois
# version 0.1
Post Reply