mIRC Home    About    Download    Register    News    Help

Print Thread
#198817 04/05/08 11:05 PM
Joined: Oct 2007
Posts: 102
B
bcancer Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2007
Posts: 102
Will this work to kban one and two letter nicks?

On @*:Join:#chat: {
if ( %Bots == off ) || ( %Bots == $null ) { return }
if ($regex($nick,/^[a-z]|[0-2]{2}!)) { ban -ku60 $chan $nick 2 14Possible Botnet Detected }
}

bcancer #198818 04/05/08 11:41 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Code:
if ($regex($nick,^..?$)) {
  ban -u60 ?!*@*
  ban -u60 ??!*@*
  kick $chan $nick possible Botnet (no nicks shorter than 3 chars allowed)
}

Please be more specific about "letters" if this isn't what you are looking for smile
Atm, it will match nicks like: a ^ b1 c_ [] |x 33

Note that I changed the ban part, too: banning all nicks made of one or two chars. (Of course, you can keep your ban on *!*@host.domain. If it's a botnet, you might flood yourself off the net if setting tons of bans too fast).


If it's only about nick length, you could use the simple: if ($len($nick) < 3)

Horstl #198819 05/05/08 12:43 AM
Joined: Oct 2007
Posts: 102
B
bcancer Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2007
Posts: 102
Thx very much its exacly what I needed.

Horstl #198826 05/05/08 01:33 AM
Joined: Oct 2007
Posts: 102
B
bcancer Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2007
Posts: 102
Ok what about nicks like this:
Would this work: ^[a-z]{2}\[0-20]{20}!

a726353838
b993746474
h0165446
k65641413154

Last edited by bcancer; 05/05/08 01:35 AM.
bcancer #198827 05/05/08 01:47 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
there's a called /echo that you can use to test this:

//echo -a $regex(a726353838, /^[a-z]{2}\[0-20]{20}!/)

and then you'll have the answer for yourself.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #198828 05/05/08 01:57 AM
Joined: Oct 2007
Posts: 102
B
bcancer Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2007
Posts: 102
Ok type this: //echo -a $regex(a726353838, /^[a-z]{2}\[0-20]{20}!/)
and i got this 0
what does it mean?

bcancer #198831 05/05/08 03:10 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
0 means "doesn't match"

1 or higher means "does match"

-genius_at_work

Horstl #198994 07/05/08 04:41 PM
Joined: Jan 2006
Posts: 111
N
Vogon poet
Offline
Vogon poet
N
Joined: Jan 2006
Posts: 111
Originally Posted By: Horstl
Code:
if ($regex($nick,^..?$)) {
  ban -u60 ?!*@*
  ban -u60 ??!*@*
  kick $chan $nick possible Botnet (no nicks shorter than 3 chars allowed)
}

Please be more specific about "letters" if this isn't what you are looking for smile
Atm, it will match nicks like: a ^ b1 c_ [] |x 33

Note that I changed the ban part, too: banning all nicks made of one or two chars. (Of course, you can keep your ban on *!*@host.domain. If it's a botnet, you might flood yourself off the net if setting tons of bans too fast).


If it's only about nick length, you could use the simple: if ($len($nick) < 3)


What the .... is wrong with if ($len($nick) < 3) ???

noMen #199003 07/05/08 06:43 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Absolutely nothing, just as the threads topic is "regex help"...

Horstl #199008 07/05/08 07:51 PM
Joined: Oct 2007
Posts: 102
B
bcancer Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2007
Posts: 102
thx guys.


Link Copied to Clipboard