mIRC Home    About    Download    Register    News    Help

Topic Options
#411 - 09/12/02 12:48 AM Bad ident
KennyJ Offline
Ameglian cow

Registered: 09/12/02
Posts: 25
Loc: Vietnam
How do I ban bad ident when someone connect to a channel or the server?
_________________________
KennyJ@VietSweet.com

Top
#412 - 09/12/02 04:34 AM Re: Bad ident
Dana Offline
Vogon poet

Registered: 08/12/02
Posts: 144
Loc: Montreal, Canada
Code:
On @*:JOIN:#channelname:{
  var %_ident = $gettok($gettok($fulladdress,1,$asc(@)),2,$asc(!))
  if (whateverbadword isin %_ident) { ban # $nick 2 | kick # $nick bad ident }
}

Replace "#channelname" with the name of the channel that you're an op in. Replace "whateverbadword" with whatever ident you want to get banned.

I apologize if I'm using $asc() but I actually don't have a copy of mIRC available for me to verify the appropriate ASCII numbers for the respective characters. However, this should work.
_________________________
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke

Top
#413 - 09/12/02 06:11 AM Re: Bad ident
KennyJ Offline
Ameglian cow

Registered: 09/12/02
Posts: 25
Loc: Vietnam
HOw do I set it multi bad ident(cussing words)?

Like this.. and so on?

if (badword1 isin %_ident) (badword2 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }
_________________________
KennyJ@VietSweet.com

Top
#414 - 09/12/02 06:39 AM Re: Bad ident
SWV1 Offline
Self-satisified door

Registered: 09/12/02
Posts: 4
Almost...

You need to have an OR between the conditions.

OR = ||

Like this:

if (badword1 isin %_ident) || (badword2 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }



Three "badwords" would be:

if (badword1 isin %_ident) || (badword2 isin %_ident) || (badword3 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }


You could also set up a list of "badwords" in a text file, read each one into the script line by line, then test to see if it exists in the ident. you would need to use $read $lines to accomplish this. If you have a long list of words, this would save a little time and programming, but for a short list the if statements would be easier.

--------------------------------------------------------------------------
//HOw do I set it multi bad ident(cussing words)?

//Like this.. and so on?

//if (badword1 isin %_ident) (badword2 isin %_ident) { ban # $nick 2 | kick # $nick bad ident }



Top
#415 - 09/12/02 07:51 AM Re: Bad ident
Merlin Offline
Vogon poet

Registered: 08/12/02
Posts: 164
Loc: Germany
This line gets the User ID from a host of a nick (in the ON JOIN Event):
Code:
 
VAR %getuid = $remove($gettok($gettok($fulladdress,1,64),2,33),~) 

make a variable holding bad words (or write into a ini-file and later used $readini)
Code:
 SET %BadWordList word1,word2,word3 

and then use a WHILE loop and
Code:
 
IF ($istok(%BadWordList,%getuid,44)) {  appropriate action here }  

Hopefully this points you into the right direction smile
_________________________
DALnet: #HelpDesk, #mIRC, #MISHScript - Undernet: #mIRC, #mIRC-Scripts

Top
#416 - 10/12/02 03:19 AM Re: Bad ident
KennyJ Offline
Ameglian cow

Registered: 09/12/02
Posts: 25
Loc: Vietnam
I try to use the codes above, it didn't work.

Code:
#badident on
on @*:join:#: {  
  var %_ident = $gettok($gettok($fulladdress,1,$asc(@)),2,$asc(!))  
  if badword1 isin %_ident || $&
    badword2  isin %_ident || $&
    badword3  isin %_ident || $&
    badword4  isin %_ident || $&
    badword5  isin %_ident || $&
    badword6  isin %_ident || $&
    badword7  isin %_ident || $&
    badword8  isin %_ident || $&
    badword9  isin %_ident || $&
    badword10 isin %_ident || $&
    badword11 isin %_ident || $&
    badword12 isin %_ident || $&
    badword13 isin %_ident { 
      ban # $nick 2
      kick # $nick 0,1Please change your IDENT! then type /join # 
  }
}
#badident end

I even put the (badword isin %_ident) || (badword2 isin %_ident) still doesn't work.. even I put
on !@*:join:#:
on @*:join:#:
Still doesn't work.. any one know why?

EDIT: reformatted the long line for this forum and changed the obviously offensive words; changed one $1- to %_ident; no other changes. -Hammer


Edited by Hammer (09/03/03 10:28 PM)
_________________________
KennyJ@VietSweet.com

Top
#417 - 10/12/02 09:12 AM Re: Bad ident
Hammer Offline
Hoopy frood

Registered: 07/12/02
Posts: 1321
Loc: Georgia, USA
Merlin was correct.
Code:

#BadIdent on
on @!*:JOIN:#:{
  ;
  ; Edit this line to add new bad userid's to your list, separated by exclamation marks (ASCII 33).
  var %BadUserIDs = pitch!clay!dirt!mud!slime!gross!horrid!yukky!realbad!worse
  ;
  ; Edit this line to modify your kick message.
  var %KickMessage = Please change your IDENT! Then reconnect to apply the change before you /join $chan again!
  ;
  if ($istok(%BadUserIDs,$remove($gettok($gettok($fulladdress,2,33),1,64),~),33) {
    ;
    ; This line bundles the BAN and KICK commands into a single data packet (faster)
    .raw $+(MODE $chan +b $address($nick,2),$crlf,KICK $chan :,%KickMessage)
  }
}
#BadIdent end

Of course, It makes sense that, if you're going to do such a list of bad idents/nicks/vhosts/whatever, that you're also going to have to manage them somehow. That management is best done outside of the in JOIN event. Probably something along the lines of a small system of code to manage a variable called %BadUserIDs and the same would apply to the kick message (%BadUserID.KickMessage). At that point, the code above simplifies to a single line script (split onto multiple lines for forum formatting).
Code:

on @!*:JOIN:#:{
  if ($istok(%BadUserIDs,$remove($gettok($gettok($fulladdress,2,33),1,64),~),33)) {
    .raw $+(MODE $chan +b $address($nick,2),$crlf,KICK $chan :,%BadUserID.KickMessage)
  }
}
_________________________
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Top
#418 - 10/12/02 11:31 PM Re: Bad ident
KennyJ Offline
Ameglian cow

Registered: 09/12/02
Posts: 25
Loc: Vietnam
thx hammer, I hope this will work this time.
_________________________
KennyJ@VietSweet.com

Top
#419 - 13/12/02 09:56 PM Re: Bad ident
FunChatter Offline
Fjord artisan

Registered: 11/12/02
Posts: 339
Loc: Athens, Greece
wouldn't something like
Code:
if (*!*badident*@* iswm $fulladdress) || (*!*otherbadident*!*@* iswm $fulladdress) ||
be more simple??

Top
#420 - 08/03/03 06:34 PM Re: Bad ident
Watchdog Offline
Hoopy frood

Registered: 09/12/02
Posts: 2984
Loc: Hill End, NSW, Australia
When you ban them, ban this *!userid@* instead of *!*@address, otherwise they can't rejoin when they have mended their ways. grin
_________________________
Induced IRC
irc.induced.net

Top
#421 - 09/03/03 09:28 AM Re: Bad ident
Hammer Offline
Hoopy frood

Registered: 07/12/02
Posts: 1321
Loc: Georgia, USA
Good point, Watchdog.

on @!*:JOIN:#: if ($istok(%BadUserIDs,$remove($gettok($gettok($fulladdress,2,33),1,64),~),33)) .raw $+(MODE $chan +b *!*,$ifmatch,@* $nick,2),$crlf,KICK $chan :,%BadUserID.KickMessage)
_________________________
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Top
#422 - 09/03/03 11:25 AM Re: Bad ident
Nobodi Offline
Vogon poet

Registered: 10/12/02
Posts: 191
Loc: Australia
i thought $istok returned $true or $false depending if the token existed or not and you could remove one $gettok using $address in place of $fulladdress

Top
#423 - 09/03/03 11:22 PM Re: Bad ident
Hammer Offline
Hoopy frood

Registered: 07/12/02
Posts: 1321
Loc: Georgia, USA
Remember that %BadUserIDs contains a list of "words", tokenized on the ! character, such as:

%BadUserIDs = pitch!clay!dirt!mud!slime!gross!horrid!yukky!realbad!worse

Obviously, the ! character cannot be used in an ident, so it's a good choice to separate them.
Code:
;  Chop off the nick!
var %userid = $gettok($fulladdress, 2, 33)
 
;  Chop off @host 
%userid = $gettok(%userid, 1, 64)
 
;  And remove any leading ~ from the userid
%userid = $remove(%userid, ~)
 
;  Find a matching token number, if present
var %N = $findtok(%BadUserIDs, %userid, 1, 33)
 
;  And finally, grab the token from %BadUserIDs
var %BadUserID = $gettok(%BadUserIDs, %N, 33)
 
;  After all that, see if %BadUserID contains anything
if %BadUserID != $null {

All of that is exactly the same as this:
Code:

;  Doing it in one fell swoop
if $gettok(%BadUserIDs, $findtok(%BadUserIDs, $remove($gettok($gettok($fulladdress,2,33),1,64),~), 1, 33), 1, 33) != $null {

$istok() returns $true or $false, perfect for a conditional statement. Either their userid is present in its full form in %BadUserIDs or it's not. There is no need to $gettok() it at all - you don't really care which one they matched. If you did, you could have the same functionality by using $findtok() to get the token number and using that inside your $gettok(). However, if $istok() matches in my original way, then you can simply use their userid to ban with. You will have the same effect.
_________________________
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Top
#424 - 10/03/03 12:06 AM Re: Bad ident
Nobodi Offline
Vogon poet

Registered: 10/12/02
Posts: 191
Loc: Australia
the reference to $istok returning $true or $false was more in relation to the $ifmatch in the ban mask,

.raw $+(MODE $chan +b *!*,$ifmatch,@* $nick,2),$crlf,KICK $chan :,%BadUserID.KickMessage)

where the $ifmatch would always add $true in the identd, not the bad identd as intended.

Top
#425 - 10/03/03 12:09 AM Re: Bad ident
Hammer Offline
Hoopy frood

Registered: 07/12/02
Posts: 1321
Loc: Georgia, USA
Heh. I have no clue why $ifmatch snuck in there. It certainly wasn't in the original versions I wrote. :tongue: Definitely my bad, though.
_________________________
DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Top
#426 - 10/03/03 03:38 AM Re: Bad ident
Nimue Offline
Hoopy frood

Registered: 08/12/02
Posts: 699
Loc: Sunshine, Oz.
$matchtok() will return the token instead of the tokens position in the string
$ial($nick).user or $gettok($address,1,64) return the same as $gettok($gettok($fulladdress,2,33),1,64)
Code:
if $matchtok(%BadUserIDs,$remove($ial($nick).user,~),1,33) {
  .raw $+(MODE $chan +b *!*,$ifmatch,@*,$crlf,KICK $chan $nick :,%BadUserID.KickMessage)
}

Top