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.

Searching For the Script which can Ban Badnicks!!!!

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
B
Bingooss
Voice
Posts: 11
Joined: Sun Sep 19, 2004 6:32 pm

Searching For the Script which can Ban Badnicks!!!!

Post by Bingooss »

Hello !

Well do anyone of you have a script which can ban the bad nicks.Like the nicks which contains some offensive words like *sex*,*lesiban* etc.. get banned by that scirpt.

I searched the Tcl Archieve on www.egghelp.org and on www.tclscript.com

I got two such scripts.

One of them is: Bad nick Protection by Prince_of_the_net

There is some thing wrong in this script , because one the eggdrop bot banned one bad nick, then afterwards the bot go wild and start banning every nick, which enter the channel.

The other one is " BAD-NICK BY ZIMO-ZIMO "

The Problem with this one is that once the bot banned some badnick, the operators cannot remove the ban for that Nick, Even if the culprit changes his nick and join the channel with some normal or fine nick, still the bot banned that nick. and then put that identity in its permanent ban list. so this also create problems, and the user cannot join that channel till the bot internal ban list is cleared.

One way is to enter the bad identies and nicks in the akick list of the channel.

But its much easy to have a badnick script, which can work for multiple channels, without editing the akick list of all the channels.

So hope to see a script for bad nicks soon...
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set badnicks [list "*word1*" "*word2*" "*word3*"]

bind join - * ban:bnick
bind nick - * ban:bnick

proc ban:bnick {nick uhost hand chan {nn ""}} {
global badnicks
set bbanmask "*!*@[lindex [split $uhost @] 1]"
if {$nn == ""} { set nn $nick }
if {![isbotnick $nick]} {
  foreach badnick $badnicks {
   if {[string match -nocase  $badnick $nn]} {
    putserv "MODE $chan +b $bbanmask"
    putserv "KICK $chan $nick :Bad nick detected."
    break
   }
  }
 }
}
This will ban badnicks on join and on nick change, and will not reset the ban if someone removes the ban.

PS: If you did a forum search you'd have found a very similar code, so try that.
B
Bingooss
Voice
Posts: 11
Joined: Sun Sep 19, 2004 6:32 pm

Post by Bingooss »

It Seems to work fine. Thankx for your reply. Have nice time..
User avatar
Linux
Halfop
Posts: 71
Joined: Sun Apr 04, 2004 4:20 pm
Location: Under The Sky

Post by Linux »

Its much better if Bot bans ONLY badnicks not the IP/host :)

Code: Select all

set badnicks [list "*word1*" "*word2*" "*word3*"] 

bind join - * ban:bnick 
bind nick - * ban:bnick 

proc ban:bnick {nick uhost hand chan {nn ""}} { 
global badnicks 
set bbanmask "*$nick*!*@*" 
if {$nn == ""} { set nn $nick } 
if {![isbotnick $nick]} { 
  foreach badnick $badnicks { 
   if {[string match -nocase  $badnick $nn]} { 
    putserv "MODE $chan +b $bbanmask" 
    putserv "KICK $chan $nick :Bad nick detected." 
    break 
   } 
  } 
 } 
}
-REGARDS-
I'm an idiot, At least this one [bug] took about 5 minutes to find...
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

banning bad nicks with { and other special chars

Post by rosc2112 »

I've looked at bunches of badnick ban scripts, and they all seem to have this one problem in common, and that is, not handling { or [ special chars. I managed to fix this script to handle "{" but I'm at a loss as to how to make it handle "["

I've looked through the forums and documentation, but I can't figure out how to handle this.

This is what I have:

Code: Select all

set badnicks [list \
"sex" \
"s3x" \
"{" \
"["
] 
   
set bnduration 1m
set badnickreason "Don't use offensive words in your nick.."
bind join - * filter_bad_nicks
bind nick - * filter_bad_nicks

proc filter_bad_nicks {nick uhost hand channel} {
 global badnicks badnickreason banmask botnick bnduration
  set handle [nick2hand $nick]
   set banmask "*$nick*!*@*"
        foreach badnick [string tolower [split $badnicks]] {
        if {[string match -nocase *$badnick* $nick]}  {
       if {[matchattr $handle +f]} {
           putlog "-Anti Bad Nick Script- $nick ($handle) with +f joined $channel"
           puthelp "PRIVMSG $channel :Ohh, aren't you so cool with that naughty nick, $nick..<eyeroll>"
       } elseif {[matchattr $handle +o]} {
           putlog "-Anti Bad Nick Script- $nick ($handle) with +o flags joined $channel"
           puthelp "PRIVMSG $channel :Ohh, aren't you so cool with that naughty nick, $nick..<eyeroll>"
       } else {
           putlog "-Anti Bad Nick Script- KICKED $nick on joining $channel"
           putquick "KICK $channel $nick :$badnickreason"
           newchanban $channel $banmask $botnick $badnickreason $bnduration
       }
    }   
  }
}
How would I fix this? Any clues appreciated =)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Instead of using
  • , use {}. i.e.

    Code: Select all

    set badnicks {
     "sex"
     "s3x"
     "{"
     "["
    }
Last edited by Sir_Fz on Fri Mar 03, 2006 7:40 pm, edited 1 time in total.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Did you mean to have "set set" or was that a typo? Using just "set badnicks { "this" "that" "{" } makes the bot crash..Thats why I made it use
  • but that still crashes on trying to use "[" in the banlist..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Code: Select all

set badnicks {
 "sex"
 "s3x"
 "{"
 "["
}
You may also wish to read the following page:

How to write eggdrop scripts that won't choke on special characters
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Been there, don't know how to apply it in this case..Actually, I did apply it, and fixed the problem with handling "{" but it didn't help with handling "["


Anyone else have a clue?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Try examining xchannel.tcl by demond for inspiration.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Alchera wrote:Try examining xchannel.tcl by demond for inspiration.
actually it doesn't work on nicks, but on realnames, channels joined, and server name

there is absolutely no need of a script to ban "bad" nicks, you simply create +k user record and add *nick*!*@* masks to it
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Same problem with that xchannels.tcl script, it does not handle "[" as an item to ban. It handled "{" but I've already fixed that. I have been unable to get any script to handle "[" as a char to ban on.

This is what xchannels.tcl says, when I tested it with [ in the badwhois.txt:

[03:48] Tcl error [::xchannel::gotwhois]: couldn't compile regular expression pattern: brackets [] not balanced

So, does anyone have a real solution to this?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that's not xchannel's fault, that's your fault

learn regexps
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

How is it my fault that your script can't handle [ as part of a banned channel name?

Really, if you all don't know the answer, why bother replying?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

I found a solution. This bans { [ } ] \ and so forth in nicks.

Code: Select all

set badnicks "\
sex \
s3x \
\{ \
\\ \
\[ \
\] \
\}
"

set bnduration 1m
 
### Set Your Ban Reason
set badnickreason "Bad nick."

bind join - * filter_bad_nicks
bind nick - * filter_bad_nicks

proc filter_bad_nicks {nick uhost hand channel {nn ""}} {
        global badnicks badnickreason banmask botnick bnduration
        if {$nn == ""} { set nn $nick }
        set handle [nick2hand $nick]
        set banmask "*$nick*!*@*"
        if {![isbotnick $nick]} {
        foreach badnick [string tolower [split $badnicks]] {
                if {[string match -nocase *$badnick* $nn] == 1} {
                        if {([matchattr $handle +f] == 1) || ([matchattr $handle +o] == 1)} {
                               puthelp "PRIVMSG $channel :Ohh, aren't you so cool with that naughty nick, $nick..<eyeroll>"
                                return 0
                                } else {
                                        putquick "KICK $channel $nick :$badnickreason"
                                        newchanban $channel $banmask $botnick $badnickreason $bnduration
                                }
                        }
                }
        }
}
Post Reply