All pastes #1565561 Raw Edit

Urza's clone scanner

public text v1 · immutable
#1565561 ·published 2009-09-14 14:52 UTC
rendered paste body
; #################################################################
; ## Simple Clone detector                                       ##
; ## Written by Urza (Urza23@hotmail.com)                        ##
; ## Written and tested in mIRC 6.16/6.17                        ##
; #################################################################

menu channel,menubar {
  Clone Detection settings
  .$iif($group(#CloneDetect) == on,Disable,Enable) clone scan on join: {
    var %status = $iif($group(#CloneDetect) == on,Disable,Enable)
    $+(.,%status) #CloneDetect
    echo 7 -at * On join clone scanning $+(%status,d.) Users will $iif(%status == Disable,no longer,now) be scanned for clones when they join
  }
  .$iif($active ischan,Scan for clones in $active):CloneScan
}
#CloneDetect on
on *:join:#: {
  if ($address($nick,2) == $address($me,2)) halt
  if ($read(allowedhost.txt,w,$address($nick,2))) halt
  if ($ial($address($nick,2),0) > 1) { 
    var %x = 1
    while (%x <= $ial($address($nick,2),0)) {
      var %clones = $iif(%clones,%clones &) $ial($address($nick,2),%x).nick
      inc %x
    }
    echo 10 -t $chan [Clones Detected] %clones @ $site
  }
}
#CloneDetect end
alias CloneScan {
  if ($1 == on) {
    if ($group(#CloneDetect) == on) Echo 4 -at Clone Scanning on join is already enabled 
    else {
      .enable #CloneDetect
      echo 7 -at * On join clone scanning Enabled. Users will now be scanned for clones when they join
    }
  }
  elseif ($1 == off) {
    if ($group(#CloneDetect) == off) Echo 4 -at Clone Scanning on join is already disabled 
    else {
      .disable #CloneDetect
      echo 7 -at * On join clone scanning Disabled. Users will no longer be scanned for clones when they join
    }
  }
  elseif ($active !ischan) echo 4 -a ERROR: You need to scan in a channel 
  else {
    who $chan
    var %nicks = $nick($chan,0), %x = 0
    while (%x <= %nicks) {
      var %host = $address($nick($chan,%x),2)
      if (%host != $address($me,2)) && (!$read(allowedhost.txt,w,%host)) {
        if ($ialchan(%host,$chan,0) > 1) && (!$istok(%clone.hosts,%host,44)) {
          var %y = 1, %clones = $ialchan(%host,$chan,0), %clones.found = yes
          while (%y <= %clones) {
            var %nick = $gettok($ialchan(%host,$chan,%y),1,33)
            var %clone.nicks = $iif(%clone.nicks,%clone.nicks &) %nick
            inc %y
          }
          echo 10 -a [Clones Detected] %clone.nicks @ $gettok(%host,2,64)
          var %clone.hosts = $addtok(%clone.hosts,%host,44)
          unset %clone.nicks
        }
      }
      inc %x
    }  
    if (!%clones.found) echo 10 -a No clones found
  }
}