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.

Ban nicks with ugly characters

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
h
hellohello
Voice
Posts: 12
Joined: Fri Feb 09, 2007 8:12 pm

Ban nicks with ugly characters

Post by hellohello »

I have a script request that hopefully won't be too difficult.

We would like to ban users that have a \ in their nick. Why not add a banmask? The server we are on ignores the \ due to a current bug, so it must be in the form of *!*user@host with a 1 minute unban period.

Thank you in advance!
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

try banning *|*!*@* (on rfc compliant networks, "|" is the lowercase version of "\")
Have you ever read "The Manual"?
h
hellohello
Voice
Posts: 12
Joined: Fri Feb 09, 2007 8:12 pm

Post by hellohello »

Hi, thanks for the tip, I'm aware of the rfc. However, this ban doesn't work and has been a known bug they just don't want to fix!
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Something like this should do the trick:

Code: Select all

#Mask is matched against "#channel nick!user@host", % matches any single word (in this case the channel)
#Replace % if you wish to limit this script to only operate on a single channel
bind join - "% *\\*!*@*" join:badnick

proc join:badnick {nick host hand chan} {
#Make sure we don't ban friendly people (owner, master, op, or friend)
 if {[matchattr $hand +fomn| $chan]} {return 1}
 newchanban $chan "*!$host" $::botnick "Bad nickname, please try again." 1
}
Edit:
To clarify, this will only kick ppl with "bad nicks" when they join the channel. It will not check when ppl change nicknames within the channel.
To handle nick-changing, add something like this:

Code: Select all

#Mask is matched against "#channel newnick", % matches any single word (in this case the channel)
#Replace % if you wish to limit this script to only operate on a single channel
bind nick - "% *\\*" nick:badnick

proc nick:badnick {nick host hand chan newnick} {
#Make sure we don't ban friendly people (owner, master, op, or friend)
 if {[matchattr $hand +fomn| $chan]} {return 1}
 newchanban $chan "*!$host" $::botnick "Bad nickname, please try again." 1
}
NML_375
h
hellohello
Voice
Posts: 12
Joined: Fri Feb 09, 2007 8:12 pm

Post by hellohello »

Hey there, thanks for the help... I couldn't get them to work though. They don't do anything when a user joins who has \ in his nick.... I don't know why though.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Current code will not ban people who are recognized as "friend", "op", "master", or "owner".
Do you have problems with random users, or just the ones above?
NML_375
h
hellohello
Voice
Posts: 12
Joined: Fri Feb 09, 2007 8:12 pm

Post by hellohello »

I added a user to the bots and gave it a global +f flag, after I removed the 'f' flag from the script. This to prevent 'join flood' messages when testing. It still doesn't work...
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Sorry, my bad;
bindings need to be something like this:

Code: Select all

bind nick - "% *\\\\*" nick:badnick
bind join - "% *\\\\*!*@*" join:badnick
NML_375
h
hellohello
Voice
Posts: 12
Joined: Fri Feb 09, 2007 8:12 pm

Post by hellohello »

Yeah, works like a charm. Thanks!! 8)
Post Reply