egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

badrealname bug
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
jsilvestre
Voice


Joined: 05 Mar 2005
Posts: 20
Location: Lisbon, Portugal

PostPosted: Tue Apr 12, 2005 9:31 am    Post subject: badrealname bug Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Apr 12, 2005 10:09 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Tue Apr 12, 2005 12:41 pm    Post subject: Reply with quote

strlwr is part of alltools.tcl
Back to top
View user's profile Send private message Send e-mail
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Apr 12, 2005 12:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Apr 12, 2005 2:44 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Linux
Halfop


Joined: 04 Apr 2004
Posts: 71
Location: Under The Sky

PostPosted: Tue Apr 12, 2005 9:42 pm    Post subject: Reply with quote

Code:
global badr

is this the missing part ?!? Rolling Eyes
_________________
I'm an idiot, At least this one [bug] took about 5 minutes to find...
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Apr 13, 2005 5:10 am    Post subject: Reply with quote

Linux wrote:
Code:
global badr

is this the missing part ?!? Rolling Eyes

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
View user's profile Send private message MSN Messenger
jsilvestre
Voice


Joined: 05 Mar 2005
Posts: 20
Location: Lisbon, Portugal

PostPosted: Wed Apr 13, 2005 5:30 am    Post subject: Reply with quote

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 Very Happy
_________________
Best Regards

Josť Eduardo Silvestre
Back to top
View user's profile Send private message Send e-mail MSN Messenger
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Apr 13, 2005 5:59 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Linux
Halfop


Joined: 04 Apr 2004
Posts: 71
Location: Under The Sky

PostPosted: Wed Apr 13, 2005 6:06 am    Post subject: Reply with quote

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 Shocked
_________________
I'm an idiot, At least this one [bug] took about 5 minutes to find...
Back to top
View user's profile Send private message
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Wed Apr 13, 2005 6:11 am    Post subject: Reply with quote

Remember guys this forum has lost a shed load of posts. Maybe the solution / final code was lost. Just a thought Smile
_________________
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
View user's profile Send private message Visit poster's website
Linux
Halfop


Joined: 04 Apr 2004
Posts: 71
Location: Under The Sky

PostPosted: Wed Apr 13, 2005 6:12 am    Post subject: Reply with quote

Humans && Mistakes = Possible Laughing

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Apr 13, 2005 9:15 am    Post subject: Reply with quote

The complete script can be found at www.r0x0ring.com
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3640
Location: Mint Factory

PostPosted: Fri Apr 15, 2005 4:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Volume
Halfop


Joined: 23 May 2003
Posts: 84

PostPosted: Fri Jul 22, 2005 2:10 pm    Post subject: tcl error Reply with quote

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

what is the problem?

## § BadWhois
# version 0.1
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber