Clone scanner and kicker

By tye on Feb 07, 2004

These code snippets will scan for and kick/ban clones.

; Clones snippets
; Tye (tye at mirc . net) DALnet #mIRC / Undernet,
; This collection of snippets does a few things:
;  - Displays all clones in a channel
;  - Displays a user's clones when they join a channel
;  - Kick/Ban clones when they join a channel (enabled per channel)
;  - Kick/Ban clones in a channel
; These scripts are public domain. You can do whatever you want with them.
; If you need help with with these snippets please ask your question on the
; forums.

; To install simply paste the code in your remotes
; The snippets can be used/configured from the channel/nicklist popups
; The 'clone threshold' setting is how many _clones_ are allowed in the channel (not how many users from the same host). A threshold of 0 means no clones are allowed (only 1 user per host)

; /showclones #channel [-k]
; Will display all clones in #channel
; If you give the -k parameter all clones above the channel's threshold will be kicked/banned
alias showclones {
  if ($hget(clones)) hfree clones
  hmake clones 10
  var %x = $nick($1,0)
  while (%x) {
    var %addr = $address($nick($1,%x),2)
    ; Get user's clones
    var %g = $clones(%addr,$1)
    var %n = $gettok(%g,2-,32), %g = $gettok(%g,1,32)
    if (%n) && (!$hget(clones,%addr)) {
      ; If we haven't already shown clones from this host then do that now
      echo $colour(info) $1 *** %g clones from %addr $+ : %n
      ; If there are more clones than the threshold, and the user is not protected, start kicking
      if ($2 = -k) && (%g > $thresh($1)) && (!$is_clone_prot($address($nick($1,%x),5))) {
        mode $chan +b %addr
        .timer 1 600 mode $chan -b %addr
        var %xx = $ialchan(%addr,$1,0)
        while (%xx) {
          if ($ialchan(%addr,$1,%xx).nick isreg $1) { kick $chan $ifmatch Clones from %addr }
          dec %xx
      hinc clones %addr
    dec %x
  hfree clones

; $clones(*!*@site,#channel)
; Returns the number of clones matching *!*@site and their nicknames in this format:
;    N nicknames
; where N is the number of clones and nicknames is a space delimited list of the users.
alias clones {
  var %x = $ialchan($1,$2,0)
  if (%x = 1) { return 1 }
  if (%x > 80) { return %x Too many to list }
  var %r
  while (%x) {
    %r = %r $ialchan($1,$2,%x).nick
    dec %x
  return $ialchan($1,$2,0) %r

; The options below the seperator are per channel settings.
menu channel {
  Clone Utilities
  .Show clones in $chan:showclones #
  .Kick/Ban current clones:if ($input(Are you sure you want to kick/ban all clones in $chan $+ ?,y)) { showclones # -k }
  .$iif($($+(%,clones.join),2),$style(1)) Show clones on join:if ($($+(%,clones.join),2)) { set $+(%,clones.join) 0 } | else { set $+(%,clones.join) 1 }
  .$iif($($+(%,clones.kick.,$chan),2),$style(1)) Kick/Ban clones on join:if ($($+(%,clones.kick.,$chan),2)) { set $+(%,clones.kick.,$chan) 0 } | else { set $+(%,clones.kick.,$chan) 1 }
  .Clone threshold - $thresh($chan).1:set $+(%,,$chan) $input(Enter how many clones a site is allowed in the channel [0 means only 1 user/host $+ $chr(44) 1 means 2 users/host]:,e)
menu nicklist {
  $iif(!$is_clone_prot($address($$1,5)),Clone Utilities)
  .Protect User
  $iif($is_clone_prot($address($$1,5)),Clone Utilities)
  .Unprotect $is_clone_prot($address($$1,5)).addr:ruser $is_clone_prot($address($$1,5)).addr
alias -l getmasks {
  if ($1 > 19) { return }
  return $1 $address($snick($active,1),$1) $+ :auser cloneprotect $address($snick($active,1),$1)
; $is_clone_prot(nick!user@host)
; Returns $true of user is protected from clone kick
alias is_clone_prot {
  var %x = $ulist(*,cloneprotect,0)
  while (%x) {
    var %a = $ulist(*,cloneprotect,%x)
    if (%a iswm $1) { return $iif($prop = addr,%a,$true) }
    dec %x
  return $false
ON *:JOIN:#: {
  ; Show users clones
  var %n = $clones($wildsite,$chan)
  if ($($+(%,clones.join),2)) {
    if ($gettok(%n,2-,32)) {
      echo -tc info2 $chan * $gettok(%n,1,32) clones from $wildsite $+ : $gettok(%n,2-,32)
  ; If you are opped, there are more clones from the host than the threshold allows, kicking clones has been enabled for this channel and the user is not protected, kick/ban the clones
  if ($me isop $chan) && ($gettok(%n,1,32) > $thresh($chan)) && ($($+(%,clones.kick.,$chan),2)) && (!$is_clone_prot($fulladdress)) {
    ; Ban the host if we haven't already
    if (!$($+(%,clonekicking,$cid,$chan,$wildsite),2)) {
      mode $chan +b $wildsite
      .timer 1 600 mode $chan -b $wildsite
      set -u10 $+(%,clonekicking,$cid,$chan,$wildsite) 1
    var %x = $ialchan($wildsite,$chan,0)
    while (%x) {
      ; Kick this user is we haven't already
      if ($ialchan($wildsite,$chan,%x).nick isreg $chan) && (!$($+(%,clonekicking,$cid,$chan,$ifmatch),2)) {
        var %nick = $ialchan($wildsite,$chan,%x).nick
        kick $chan %nick Clones from $wildsite
        set -u10 $+(%,clonekicking,$cid,$chan,%nick) 1
      dec %x
; Returns the clone threshold for a channel
; $thresh(#channel).N
; If you give the N parameter that value will be subtratced from the threshold.
; The threshold returns the maximum number of users a host can have in #channel,
; not the number of clones a host can have. Use $thresh(#channel).1 to get the
; number of clones a host can have.
alias -l thresh {
  if ($($+(%,,$1),2) != $null) { return $calc($ifmatch + 1 - $prop) }
  return $calc(1 - $prop)


Sign in to comment.
x1L22   -  Jul 31, 2010


Joshuaxiong1   -  Oct 08, 2007

I can always remember that handsome face. Look just like my cousin.

Joshuaxiong1   -  Oct 08, 2007

What does the clone threshold do? Although is not working.

Joshuaxiong1   -  Oct 08, 2007

Oh wait I just found out. You can right click on the middle of the screen and excute the command. Wow just what I said above. There is an autokick on for clones. RANK 1

Joshuaxiong1   -  Oct 08, 2007

Wow this is so cool!!! Rank 1 Wow I change my mind of the other clone. It would be best if it have autokick clone instead of having the excute the command over time. I thought this was a bad script but when I found out how to use it. You should post the command on the introduction.

Here how it work it you don\'t know how.
/showclones #channel Scan for clone
/showclones #channel -k KB all clone

Now I should of better read the script more.

petrillo2000   -  Oct 18, 2006

hi just woundering this snipet is really good i do like it alot but is there a way i can add a ban time to ass it just ans the clones then u have to remove it urself but i want to add a timer so say it will unban in 10minutes?

Vortex   -  Jul 19, 2005

It\'s awesome but..Could be changed. Everytime I scan or check for clones it shows all the Protected and anyone with Owner in the channel as a clone. Or anyone with the same ISP(Host/Mask) as a clone. For instance:
AOL, Comcast, DSL, Dail.Tampa, Dial.Miami, Dial.Boston, Dial.Net, it showed anyone with those connections as clones, even though the numbers were different. That\'s something that should be fixed in it. I tried but I messed it up, My bad. But try and make it to where it won\'t get the ISPs(Host/Masks) mixed up if they have the same connection. And..It showed anyone without a Voice or HalfOp a clone. :@..!

PCTech   -  Feb 27, 2005

I have added protected users, but when I do a \"Show Clones in #channel\" it still reports the users that are protected as \'clones\'

IXeZion   -  Jan 07, 2005

This has become a classic code.. It\'s neat, fast and beautiful :p

tye   -  Oct 23, 2004

The script does an \'isreg\' test on each nickname before it kicks them. If the person isn\'t opped or voiced when it does this then it will kick them. There is no way for the script to know if a user is a voice/hop/op if they are not opped when it checks their nickname. You can use the \'Protect User\' feature though.

MOPARonLSD   -  Oct 05, 2004

First off.. this is the best clone scanner/kicker i\'ve found to date. but, it kicks +V +h etc.. you stated to GMANN Try typing /who #channel. The script will only kick regular users (ie, users who are not voiced, hopped or opped.)\".. but its kickin them. is there some code i can add to this so it won\'t kick them at all no matter what? I\'m an avid IRC user but total noob to writing scripts etc. please help.

tye   -  Sep 09, 2004

I edited it to have 600 second bans. The ON JOIN kicker is optional. You can enable/disable it per channel.

Oops   -  Sep 08, 2004

is there an way to make it kick after 1 min ? cuz of the ping timeouts & is there an way to edit the onjoin kickban section to make it an timed ban and not an perm ?

tye   -  Aug 18, 2004

GMANN, make sure you selected a nickname. If you still get the error then your IAL is probably not updated. Try typing /who #channel. The script will only kick regular users (ie, users who are not voiced, hopped or opped.)

GMANN   -  Aug 15, 2004

Isthere any way to have it not kick and ban +v,+h,+o,+a,+q.Instead of just protecting a specific user.

GMANN   -  Aug 15, 2004

When i try to protect the user i get this error * /auser: insufficient parameters and i copied and pasted exactly what u have above in my remotes

IXeZion   -  Aug 13, 2004

I love this clonescanner

tye   -  Aug 06, 2004

The script will only kick users from a channel if you have specifically enabled the script for that channel.

SuicidalSyd   -  Aug 02, 2004

to add a timed kick ban to this script change mode $chan +b %addr to /ban -u100 $chan %addr - theres 2 of them to change. Gr8 script tye

Moviewolf   -  Jun 18, 2004

Also just a question will this script run ie every channel I\'m oped? Since some of the channels have their own script running and i don\'t want to interfere with them.

Moviewolf   -  Jun 18, 2004

Can you add a timer to it so that it will: 1) only ban the clones on join for a timed verriable that i can set for like 2 minutes for on join kick and ban & 2) a timer on the manual ban that can be done in the channel for any clones that get past the script if the person running the script is off line for a bit and clones get in. And 3) a place for a custom kick message for each . You guys are the greatest and thanks for all the help.

tye   -  Jun 05, 2004

I\'ve updated the script to allow protected users. Right click on their nickname in the nicklist and go to Clone Utilities -> Protect User. Protected users will not be kicked/banned for having clones.

thepitster   -  May 15, 2004

this is pretty good snipplet here, id like to know if you can make one where it wont kick/ban certain hosts/nicks, and btw all the others should learn if you dont like it DONT USE IT, its that simple

tye   -  Feb 24, 2004

There is code that is supposed to trigger when you are not opped.

 Respond   -  Feb 24, 2004

Also, you could\'ve put ON @*:JOIN:#:, instead of that extra if ($me isop $chan) check.

PlayboyBunny   -  Feb 10, 2004

Well this is a ral nice code! Will come in handy... gj!

 Respond   -  Feb 07, 2004

That\'s one of the best codes I\'ve ever seen!!! How could you do that?? I\'m not even that good at mIRC!

basher13   -  Feb 07, 2004

anyway i enjoy it your snippet.that was not make a sense..Haahaha

basher13   -  Feb 07, 2004

just gimme the code not your comment i dont understand what are you trying to said.Just gimme the snippet code and put your comment about how to use your snippet on the comment before u submitted snippet .If u think this is good snippet why did unot a try to make a addon ,it better and more simple.Copy and paste!

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.