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 

Searching For the Script which can Ban Badnicks!!!!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Bingooss
Voice


Joined: 19 Sep 2004
Posts: 11

PostPosted: Sat Mar 19, 2005 6:21 am    Post subject: Searching For the Script which can Ban Badnicks!!!! Reply with quote

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


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Mar 19, 2005 6:51 am    Post subject: Reply with quote

Code:
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.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Bingooss
Voice


Joined: 19 Sep 2004
Posts: 11

PostPosted: Sat Mar 19, 2005 8:39 am    Post subject: Reply with quote

It Seems to work fine. Thankx for your reply. Have nice time..
Back to top
View user's profile Send private message
Linux
Halfop


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

PostPosted: Sun Apr 10, 2005 5:16 pm    Post subject: Reply with quote

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

Code:
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...
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Mar 02, 2006 9:35 pm    Post subject: banning bad nicks with { and other special chars Reply with quote

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:

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 =)
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Mar 02, 2006 9:44 pm    Post subject: Reply with quote

Instead of using [list], use {}. i.e.
Code:
set badnicks {
 "sex"
 "s3x"
 "{"
 "["
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts


Last edited by Sir_Fz on Fri Mar 03, 2006 7:40 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Mar 02, 2006 10:01 pm    Post subject: Reply with quote

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 [list]
but that still crashes on trying to use "[" in the banlist..
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Mar 02, 2006 10:14 pm    Post subject: Reply with quote

Code:
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
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Mar 02, 2006 10:34 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Mar 02, 2006 10:45 pm    Post subject: Reply with quote

Try examining xchannel.tcl by demond for inspiration.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Mar 03, 2006 12:40 am    Post subject: Reply with quote

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] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Mar 03, 2006 4:56 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Mar 03, 2006 5:18 am    Post subject: Reply with quote

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] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Mar 03, 2006 6:19 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Mar 03, 2006 12:30 pm    Post subject: Reply with quote

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

Code:

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
                                }
                        }
                }
        }
}
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 Requests 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