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.
Old posts that have not been replied to for several years.
Damnation85
Voice
Posts: 19 Joined: Sun Dec 19, 2004 2:31 pm
Post
by Damnation85 » Wed Jan 05, 2005 7:48 am
i was wondering if somone could take the ban mask code from the linked topic below and tear it apart and comment it line by line stating what each line does and how it does it so that i and proberly many others can learn from the techniques used within the tcl
well if anyone can, i'd be grateful as it'd expand my knowledge in tcl.
Forum Post:
Link
Thanx
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Wed Jan 05, 2005 9:04 am
You are lucky, here is some old piece of code I found. I used this quite long back ago as my banmask selector. But I upgraded to a better one thanks to MC_8 and user, which is in the posts on the earlier link you gave .
Code: Select all
#Select the type of banmask to use when banning the advertiser.
# 1 - *!*@some.host.com
# 2 - *!*@*.host.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.host.com
# 5 - *!*ident*@*.host.com
# 6 - *!*ident*@some.host.com
# 7 - nick*!*@*.host.com
# 8 - *nick*!*@*.host.com
# 9 - nick*!*@some.host.com
# 10 - *nick*!*@some.host.com
# 11 - nick!ident@some.host.com
# 12 - nick!ident@*.host.com
# 13 - *nick*!*ident@some.host.com
# 14 - nick*!*ident*@some.host.com
# 15 - *nick*!*ident*@some.host.com
# 16 - nick!*ident*@some.host.com
# 17 - nick*!*ident@*.host.com
# 18 - nick*!*ident*@*.host.com
# 19 - *nick*!*ident@*.host.com
# 20 - *nick*!*ident*@*.host.com
set advbanmask "4"
#Usage:
set advertiseban [advertise:banmask $uhost $nick]
proc advertise:banmask {uhost nick} {
global advbanmask
switch -- $advbanmask {
1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
3 { set banmask "*!*$uhost" }
4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" }
6 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
7 { set banmask "$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
8 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
9 { set banmask "$nick*!*@[lindex [split $uhost "@"] 1]" }
10 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
11 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
12 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
13 { set banmask "*$nick*!*$uhost" }
14 { set banmask "$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
15 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
16 { set banmask "$nick!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
17 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
18 { set banmask "$nick!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" }
19 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
20 { set banmask "*$nick*!*[lindex [split $uhost "@"] 0]*@[lindex [split [maskhost $uhost] "@"] 1]" }
default { set banmask "*!*@[lindex [split $uhost @] 1]" }
return $banmask
}
}
Note $uhost:
ident@some.host.com
Note $nick: nick
So, like for example:
$nick!$uhost: nick!
ident@some.host.com
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Wed Jan 05, 2005 7:30 pm
Damnation85 wrote: i was wondering if somone could take the ban mask code from the linked topic below and tear it apart
Which one? (proc)
awyeah wrote: You are lucky
Why is he/she lucky? Because you gave a totally off-topic answer?
Have you ever read "The Manual"?
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Wed Jan 05, 2005 10:39 pm
This is not off-topic really. He wanted to know how to set various banmasks.
I beleive the pieces of code in the FAQ, topic BANS, are a little sophisticated, so wouldn't you say we should start him from simpler things?
So if he looks at those 20 banmasks, compare them... any dumb person should get the idea, where to split it from, which lindex to use, and also what is the purpose of maskhost?
And as for replacing numbers with ?'s or *'s, he can just use string map in the end if he wants to!
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Damnation85
Voice
Posts: 19 Joined: Sun Dec 19, 2004 2:31 pm
Post
by Damnation85 » Thu Jan 06, 2005 4:17 am
well to answer you both.
User: Your tweaked mc_8 code without the bugs was, what i was pointing to. being torn apart and commented.
awyeah: I can see from what you have put the different syntax used for each type of ban mask which was helpful. thank you.
thank you both for your help so far : o)