ircopaddon

By md5killa on Apr 13, 2014

IRC ADMIN SCRIPT SNIPPET FOR MIRC
;# Features:
;# /whois killing
;# CTCP indexing
;# Dialog based /WHO filter
;# Integrated menu system
;# Automatic resolve to ip of bans
;# Ban logging (#bans)
;# Bad nick/version banning
;# klines.conf throttling
also @connects @server @netbans snippet creates @snotice windows per category with right click commands from window such a gzlining a botnet join in real time also right click logging etc

;###########################################################################
;# IRCOp Mass Network Ban Script
;# irc:your.network.here/services
;# 
;# Features:
;# /whois killing
;# CTCP indexing
;# Dialog based /WHO filter
;# Integrated menu system
;# Automatic resolve to ip of bans
;# Ban logging (#bans)
;# Bad nick/version banning
;# klines.conf throttling
;# 
;# 
;# 
;;# resolv.dll frontend ([newb] Source available upon request)
;####################
;# 
;# Usage: $dll(resolv.dll,iptohostname,XXX.XXX.XXX.XXX)
;# It'd be nice if you used $isip before you checked it otherwise it'll return X's :D
;# I integrated it into /whois just for a quick example.  It was too slow to do a mass
;# channel ban for hosts that would not reverse dns, therefore I removed it from
;# userhost code.
;#
;# Usage: $dll(resolv.dll,hostnametoip,HOSTNAME.COM)
;# My favorite, as it resolves hosts into ips in milliseconds compared to the 3-4 seconds
;# for regular mircs' /dns.
;#
;# Usage: /dll resolv.dll getip <host> <commands>
;# Not working yet, but when I fix it it should be able to do <commands> followed by the *ip* of the host.
;# 

;$isip(127.0.0.1) ==, $isip(blah.com) == 0
alias isip { var %reg ^([[:digit:]]+)\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ | return $regex($1,%reg) }
alias isnick { return $iif($regex($1,\.),0,1) }
alias iptohost { return $dll(resolv.dll,iptohostname,$1) }
alias hosttoip { return $dll(resolv.dll,hostnametoip,$1) }
alias resolve { return $dll(resolv.dll,$iif(!$isip($1),hostnametoip,iptohostname),$1) }
alias gethost { return $iif($isip($1),$dll(resolv.dll,iptohostname,$1),$1) }
alias getip { return $iif(!$isip($1),$dll(resolv.dll,hostnametoip,$1),$1) }
alias nickip { return $gettok($hget(realhosts,$1),1,32) }
alias nickhost { return $iif($gettok($hget(realhosts,$1),2,32),$ifmatch,$gettok($hget(realhosts,$1),1,32)) }
alias getip2 { dll resolv.dll getip $1- }
;Nice alias here... If you want to test the script
alias safety { $1- }

;*Start hash table addition of user hosts*
raw 302:*:{
  var %hostname $gettok($1-,2-,64)
  var %nick $remove($gettok($2,1,61),*)
  var %ip $getip(%hostname)
  ;var %host $gethost(%nickname)
  hadd -mu15000 realhosts %nick %ip %host
  halt
}
raw 401:*:{ if ($hget(whoischeck,$2)) { halt } }
;####################
;# MASS OPER - kill, g/z/gz/k/shun-lines
;####################
;#
;# If you want to add your own mass line command (unneeded as now)
;# Just add a new Xline2, set your %linetype.
;#

alias kill2 {
  var %i,%nicks
  :nextnick
  inc %i
  if ($gettok($1,%i,44) == $null) { if ($len(%nicks) > 0) safety kill %nicks $2- | halt }
  %nicks = $addtok(%nicks,$gettok($1,%i,44),44)
  if ($modespl // %i) { safety kill %nicks $2- | %nicks = "" }
  goto nextnick
}
alias gline2 {
  set -u10 %linetype G
  mline $1-
}
alias zline2 {
  set -u10 %linetype Z
  mline $1-
}
alias gzline2 {
  set -u10 %linetype GZ
  mline $1-
}
alias kline2 {
  set -u10 %linetype k
  mline $1-
}

alias shun2 {
  set -u10 %linetype Shun
  mline $1-
}
alias -l aline {
  set -u10 %linetype A
  mline $1-
}
alias mline {
  set -u10 %linetype %linetype
  connected test3 $1-
  if (!$3) || ($remove($2,d,t,s,w,h,m) !isnum) { echo -a Usage: /Xline <nick/host/ip/mask/+nick> <time> <reason> | halt }
  ;loops though each /glinemask <nick/host>
  ;Can use Nickname, nick!user@host, or real host/ip
  var %i 1,%cur
  while ($gettok($1,%i,44)) {
    %cur = $ifmatch
    if (%cur ison #services) || (%cur ison #bans) { goto end }
    elseif (%cur == $me) { goto end }
    elseif ($chr(30) isin %cur) { tline %cur $2- | goto end }
    elseif ($isnick(%cur)) { tline %cur $2 $+([,%cur,]) $3- | goto end }
    else { tline %cur $2- }
    :end
    inc %i
  }
}

alias tline {
  set -u10 %linetype %linetype
  if (&* iswm $1) { set -u10 %linetype $right($1,-1) | tokenize 32 $2- }
  connected tline $1-
  if ($chr(30) isin $1-) { line2 $remove($1,$chr(30)) $2- | return }
  if ($isnick($1)) {
    ;makes it so that it only looks up the hostname *once* if it can't find it.
    if ($hget(tline,$1) > 1) { return }    
    if ($nickip($1)) { 
      line2 $remove($ifmatch,$chr(30)) $2 $1 $3-
      return 
    }
    else { userhost $1 | .timer 1 2 tline & $+ %linetype $1- | hinc -mu100 tline $1 }
  }
  else { line2 $1- | return }
}

alias line2 { 
  connected line2 $1-
  set -u0 %akill.id %linetype $+ $r(100000,999999) $+ - $+ %oper.tag
  if (%linetype == A) { safety os akill add + $+ $2 *@ $+ $1 $4- $+([Akill ID: %akill.id]) | return }
  safety ! $+ %linetype $+ $iif(%linetype != shun,line) $strip($iif($isnick($1),$1,*@ $+ $1) $2) $&
    $iif($left($4,1) == $chr(91),$4) $zbanreason(g,$strip($iif($left($4,1) == $chr(91),$5-,$3-)))
  var %display 10 $+ %linetype $+ $iif(%linetype != shun,-Line:,:) $+ 11 $iif($isnick($1),$1,*@ $+ $1) $&
    10for11 $2 $iif(($left($4,1) == $chr(91)), 10Nick:11 $right($left($4,-1),-1) $&
    $iif($gettok($address($remove($4,$chr(91),$chr(93)),5),2-,33),10Host:11 $ifmatch) $&
    10Reason:11 $5-,10Reason:11 $3-) 10ID:11 %akill.id
  $iif($me ison #bans,msg,.msg) #bans %display
  ;echo -tli2 10*** Adding %display
}

;####################
;# CTCPREPLY CODE
;####################
;
on *:ctcpreply:version*:{
  var %bans bottler|xdcc catcher|irc-ork|ok-bot|inph3rn0
  if ($version($1-)) {
    safety gline2 $nick $ifmatch
    haltdef
    return
  }
  if ($nick ison #bans-r-us) && (iroffer isin $1-) { haltdef | safety gline2 $nick 1h XDCC Drone | return }
  hadd -mu1500 ctcpbuffer $nick $2-
}
alias ctcpkill {
  if ($1 !ischan) { echo -a Error: /ctcpkill <#> <mask> | halt }
  var %i 1,%k,%nick
  while ($nick($1,%i,r)) {
    %nick = $ifmatch
    if ($2 iswm $hget(ctcpbuffer,%nick)) && (%nick !ison #services) && (%nick !ison #bans) { %k = $addtok(%k,%nick,44) }
    inc %i
  }
  ;kill2 %k Compromised Host
  ;gzline2 %k 1h Compromised Host (1h)
  bshun %k
}

;####################
;# Interceptor code
;####################
;# This is still in "beta" stage, i just coded it in this way after observing behavior.
;# I saw that the "evil" clients are joining/parting the channel instantly.
;# I also checked that if you killed them after they do that then excellent...
;# What I'm going to do is /whois the ones that join/part within 1 second.
;# If they're on more than... 8 channels i'll /kill them
;# Also added on join nickname kills.
;# 2.9.5 - Added global whoising, regardless of what chan.
#joins off
on ^*:join:#:{
  if ([Motion]* iswm $nick) { gline2 + $+ $nick 1d XDCC Drone }
  if (firm* iswm $nick) { 
    .msg $nick admin p3ps1 shutdown now
    $iif($me ison #bans,msg,.msg) #bans 10Shutdown:11 $nick 10Host:11 $gettok($address($nick,5),2,33)
    halt 
  }
  if ($nick ison #services) || ($nick ison #bans) { halt }
  if (!$hget(whoischeck,$nick)) { hinc -mu30 whoischeck $nick | .timerwhois $+ $nick 1 15 whois $nick | halt }
  if (# == #bans-r-us) {
    if ($nick($nick)) { $ifmatch | return }
    if ($nick ison #services) || ($nick ison #bans) { pvoice 5 #bans-r-us $nick | return }
    haltdef
  }
}
#joins end

raw 311:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 379:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 307:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 319:*:{ 
  var %i 1,%y
  while ($gettok($3-,%i,32)) {
    if ($ifmatch isin %badchans) { inc %y }
    inc %i
    if (#services isin $1-) || (#bans isin $1-) { goto end  }
  }
  if (%y > 8) { aline $2 5d Drone Client | .timer 1 5 .kill $2 5 day ban - Drone Client }
  if ($3- == #bans-r-us) {  5h Drone Client (5 hour ban) - Try to avoid channels closed by your.network.here   }
  :end
  if ($hget(whoischeck,$2)) { .timer 1 2 hdel whoischeck $2 | halt }
}
raw 312:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 301:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 313:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 310:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 317:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 318:*:{ if ($hget(whoischeck,$2)) { halt } }
raw 335:*:{ if ($hget(whoischeck,$2)) { halt } }
alias whoisscan {
  var %i 1
  while ($nick($1,%i,r)) {
    hinc -mu100 whoischeck $ifmatch
    .whois $ifmatch
    inc %i
  }
}
;*Steal info from /whois as well
raw 378:*:{
  if ($hget(whoischeck,$2)) { halt }
  var %hostname $gettok($1-,2,64)
  hadd -mu15000 realhosts $2 %ip %host
  var %ip $getip(%hostname)
  var %host $gethost(%hostname)
  echo $color(whois) -a $2 - Ip: %ip Host: %host
}
raw 379:*:{
  if ($hget(whoischeck,$2)) { halt }
  echo $color(whois) -a $2 is $4-
  halt
}

;###################
;#  ALIASES
;####################
;

alias connected { if (!$server) { echo -ai2l 10Error: 11You must be connected to use that command $1- | halt } }
alias zbanreason { return $iif($2,$+([,$2-,]) -) Contact your.network.here   $+($chr(40),ID:,%akill.id,$chr(41)) }
alias version {
  if (Bottler isin $1-) { return 1d $ifmatch }
  if (Xdcc Catcher isin $1-) { return 1d Xdcc Catcher }
  if (IRC-Ork isin $1-) { return 1d $ifmatch }
  if (OK-Bot isin $1-) { return 1d $ifmatch }
}
alias nick {
  ;I should probably make this editable through a hash table or ini :/
  if ([uw]* iswm $1) { gline2 $1 2h XDCC Drone }
  if (Ruckus-* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([B]-* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([CC]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([BnC]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([XDCC]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if (XDCC* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([WG]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([AW]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([D*M]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([B]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([HW]* iswm $1-) { gline2 $1 2h XDCC Drone }
  if (Mafia-* iswm $1-) { gline2 $1 2h XDCC Drone }
  if ([Motion]* iswm $nick) { bshun $1 2h Evil XDCC Drone }
  if (Suck-* iswm $1-) { gzline2 $1 5d Flood Bot (5d) }
  if (Luck-* iswm $1-) { gzline2 $1 5d Flood Bot (5d) }
  if (Shit-* iswm $1-) { gzline2 $1 5d Flood Bot (5d) }
  if (Shut-* iswm $1-) { gzline2 $1 5d Flood Bot (5d) }
  if (Fuck-* iswm $1-) { gzline2 $1 5d Flood Bot (5d) }
  if (Lick-* iswm $1-) { gzline2 $1 5d Flood Bot (5d) }
  if (motorcity* iswm $1-) { kill $1 Compromised Host }
  if (spy???? iswm $1-) { gline2 $1 2h Compromised Host }
}
alias bshun {
  ;gline2 $1 1h XDCC Drone
  shun2 + $+ $1 1h Compromised Host (1hr)
  ;ban -u60 #bans-r-us $1 5
  .timer 1 5 kill2 $1 Compromised Host (1hr Shun)
}
;####################
;# MENU CODE
;####################
;

alias mparse {
  ;mparse gzline 2h <reason>
  var %i 1,%a, %b $1 $2
  while ($snick(#,%i)) {
    %a = $addtok(%a,$snick(#,%i),44)
    if ($numtok(%a,44) >= 30) { $1 $iif($left($1,1 == $chr(30)),$chr(30)) $+ $remove(%a,$chr(30)) $iif(!$3,$2-,$2) $3- | %a = "" }
    inc %i
  }
  $1 $iif($left($1,1 == $chr(30)),$chr(30)) $+ $remove(%a,$chr(30)) $iif(!$3,$2-,$2) $3-
}
menu status {
  Oper
  ./WHO filter:dialog -m whofilter whofilter
}
menu menubar {
  Oper
  ./WHO filter:dialog -m whofilter whofilter
}
menu nicklist {
  Oper
  .Kill:mparse kill2 $$?="Kill Reason"
  .Lines
  ..G-Line
  ...$submenu($banmenu($1,gline2))
  ..GZ-Line
  ...$submenu($banmenu($1,gzline2))
  ..z-Line
  ...$submenu($banmenu($1,zline2))
  ..k-Line
  ...$submenu($banmenu($1,kline2))
  ..Shun
  ...$submenu($banmenu($1,shun2))
  ./WHO filter:dialog -m whofilter whofilter
}
alias banreason { var %time $$?="Ban Time" | var %reason $$?="Reason for G-Line?" | mparse $1 %time %reason }
alias bannicks { 
  var %time $$?="Ban Time" | var %reason $$?="Reason for G-Line?"
  var %i 1
  while ($snick(#,%i)) {
    $1 $chr(30) $+ $ifmatch %time %reason
    inc %i
  }
}
alias banmenu {
  if ($1 == begin) return -
  if ($1 == 1) return Reason...:banreason $2
  if ($1 == 2) return Nicks...:bannicks $2
  if ($1 == 3) return -
  if ($1 == 4) return Botnet:mparse $2 2d Botnet
  if ($1 == 5) return Bottler:mparse $2 2d Bottler Client
  if ($1 == 6) return Flooder:mparse $2 2d Flooders
  if ($1 == 7) return XDCC Drone:mparse $2 1d XDCC-Drone (1day)
  if ($1 == 8) return Trojan/Virus:mparse $2 7d Trojan/Virus spreading
  if ($1 == 9) return Irc-Ork:mparse $2 2d Irc-ork
  if ($1 == 10) return Spamming Client:mparse $2 2d Spamming/Out of control Client
  if ($1 == 11) return Unattended:mparse $2 5h Unattended Client - 5 Hour
  if ($1 == 12) return Drone:mparse $2 5h Drone Client/Compromised Host - 5 hour ban
  if ($1 == end) return -
}

menu channel {
  Oper
  .CTCP Version:ctcp # version
  .Kill mIRC Clients:ctcpkill # *mirc*
  ./WHO filter:dialog -m whofilter whofilter
  ./WHOIS Scan:whoisscan #
}

on ^*:snotice:*drone client*:{ haltdef }
on ^*:join:#bans-r-us:{ haltdef }
on ^*:part:#bans-r-us:{ haltdef }
;Ignore "BL" and "FL"
alias fl {
  var %infile $getdirbots-meta.txt
  var %outfile ip.txt
  var %i 1,%n,%t
  while (%i != $lines(%infile)) {
    %n = $gettok($read(%infile,%i),2-,64)
    echo -a %n
    %t = $read(%outfile,s,%n)
    if (!$readn) { write -a %outfile %n }
    ;whowas <blah>
    inc %i
  }
}
;Clears ban list
alias bl {
  var %i 1,%n
  while (%i != $lines(glines.txt)) {
    %n = $read(glines.txt,%i)
    .timer 1 %i $iif($gettok(%n,1,32) == G,gline,$iif($gettok(%n,1,32) === Z,gzline,$iif($gettok(%n,1,32) === z,zline,shun))) - $+ $gettok(%n,2,32)    
    inc %i
  }
}

; ------------------------------------
; Count Net-Wide G, and Z Lines
; ------------------------------------
alias countallbans { msg #bans ----------------------------------------------- | msg #bans Daily Network-Wide Ban Report: | msg #bans ----------------------------------------------- | .enable #countbansmap | map }
alias countbans {
  if ( $1 ) { set %netwidebans.server $1 } | else { set %netwidebans.server $server }
  set %netwidebans.all 0 | set %netwidebans.gz 0
  set %netwidebans.g 0 | set %netwidebans.s 0
  set %netwidebans.k 0 | set %netwidebans.z 0
  ; Perm
  set %netwidebans.allp 0 | set %netwidebans.gzp 0
  set %netwidebans.gp 0 | set %netwidebans.sp 0
  set %netwidebans.kp 0 | set %netwidebans.zp 0
  set %netwidebans.local 0 | set %netwidebans.localp 0
  .enable #countbans
  stats g %netwidebans.server
}
#countbans off
raw 223:*:{ 
  HALTDEF 
  if ( $2 isincs G ) { inc %netwidebans.g | inc %netwidebans.all | if ( $4 == 0 ) { inc %netwidebans.gp | inc %netwidebans.allp } }
  if ( $2 isincs Z ) { inc %netwidebans.gz | inc %netwidebans.all | if ( $4 == 0 ) { inc %netwidebans.gzp | inc %netwidebans.allp } }
  if ( $2 isincs s ) { inc %netwidebans.s | inc %netwidebans.all | if ( $4 == 0 ) { inc %netwidebans.sp | inc %netwidebans.allp } }
  if ( $2 isincs K ) { inc %netwidebans.k | inc %netwidebans.local | if ( $4 == 0 ) { inc %netwidebans.kp | inc %netwidebans.localp } }
  if ( $2 isincs z ) { inc %netwidebans.z | inc %netwidebans.local | if ( $4 == 0 ) { inc %netwidebans.zp | inc %netwidebans.localp } }
}
raw 219:*:{ HALTDEF | msg #bans  $+ $remove(%netwidebans.server,.your.network.here .net)  (G: $+ %netwidebans.all $+ / $+ %netwidebans.allp $+ $chr(124) $+ L: $+ %netwidebans.local $+ /  $+ %netwidebans.localp $+ ) G: $+ %netwidebans.g $+ / $+ %netwidebans.gp Z: $+ %netwidebans.gz $+ / $+ %netwidebans.gzp s: $+ %netwidebans.s $+ / $+ %netwidebans.sp K: $+ %netwidebans.k $+ / $+ %netwidebans.kp z: $+ %netwidebans.z $+ / $+ %netwidebans.zp  | nextcountserver }
alias -l nextcountserver {
  if (%netwidebans.servertok <= $numtok(%netwidebans.servers,32)) { 
    var %nextserver = $gettok(%netwidebans.servers, %netwidebans.servertok, 32)
    inc %netwidebans.servertok
    countbans %nextserver
  }
  else {
    unset %netwidebans*
    .disable #countbansmap
    .disable #countbans 
  }
}
;
#countbans end
#countbansmap off
; Map results
raw 6:*:{ 
  haltdef
  var %mapline = $null
  var %result = $regsub($2-,^[^a-zA-Z0-9]+,,%mapline)
  var %thisserver = $gettok(%mapline,1,32)
  %netwidebans.servers = $addtok(%netwidebans.servers, %thisserver,32)
  halt
}
;
; End of Map
raw 7:*:{
  haltdef
  .disable #countbansmap
  set %netwidebans.servertok 1
  if ( $numtok(%netwidebans.servers,32) >= %netwidebans.servertok ) {
    .enable #countbans
    set %netwidebans.thisserver $gettok(%netwidebans.servers,%netwidebans.servertok,32)
    inc %netwidebans.servertok
    countbans %netwidebans.thisserver
  }
  else {
    unset %netwidebans*
    .disable #countbans 
  }
  halt
}
#countbansmap end
;

#Snotice on
on ^*:snotice:*:{ 
  if (!$window(@Snotice)) { window -ae @snotice }
  if (*Notice -- Client exiting at* iswm $1-) {
    if ($regex($lower($9-),begone evil doers|botnet|client software|bottler)) {
      if ($hget(spam2,$gettok($8,2,64))) {
        hinc -mu300 spam $gettok($8,2,64)
        spamchk $gettok($8,2,64) $remove($9-,$chr(40),$chr(41))
      }
    }
    ;echo 4 -tli2 @snotice Exit at $7-
    goto end
  }
  if (*Notice -- Client exiting:* iswm $1-) {
    if ($regex($lower($8-),begone evil doers|botnet|client software)) {
      if ($hget(spam2,$gettok($gettok($7,2,64),1,41))) {
        hinc -mu300 spam $gettok($gettok($7,2,64),1,41)
        spamchk $gettok($gettok($7,2,64),1,41) $remove($8-,[,])
        ;if ($hget(spam,$gettok($gettok($7,2,64),1,41)) > 3) { zline *@ $+ $gettok($gettok($7,2,64),1,41) Your client is reconnecting too fast and has been permanently banned for: $+([,$2-,]) - Please Email glines@your.network.here .net and include gerbils.your.network.here .net }
      }
    }
    ;echo 4 -tli2 @snotice Exit $6-
    goto end
  }
  if (*Notice -- Client connecting at*:* iswm $1-) {
    hinc -mu15 spam2 $gettok($gettok($9,2,64),1,41)
    ;hinc -mu300 spam $gettok($gettok($9,2,64),1,41)
    ;spamchk $gettok($gettok($9,2,64),1,41)
    ;echo 4 -tli2 @snotice Connect $7-
    goto end
  }
  if (*Notice -- Client connecting* iswm $1-) {
    hinc -mu15 spam2 $gettok($gettok($10,2,64),1,41)
    ;hinc -mu300 spam $gettok($gettok($10,2,64),1,41)
    ;spamchk $gettok($gettok($10,2,64),1,41)
    ;echo 4 -tli2 @snotice Connect on port $remove($8,:) $9 $10
    goto end
  }
  if (*Z:Line added for*from meta*2 hours* iswm $1-) {
    echo 7 -tli2 @snotice *** Automatically Zlined $6 for excessive reconnecting
    goto end
  }
  if (*Expiring*Z:Line* iswm $1-) { goto end }
  if (*Global Z:line added for*is in error* iswm $1-) { goto end }
  if (*drone client* iswm $1-) { goto end }
  if (*added for*from $me $+ * iswm $1-) { goto end }
  echo 4 -tli2 @snotice $1- 
  :end
  haltdef 
}
#Snotice End
alias spamchk {
  if ($hget(spam,$1) > 3) { gzline *@ $+ $1 2h :Your client is reconnecting too fast after disconnected for: $+([,$2-,]) - Please wait 2 hours for the ban to wear out. }
}

on *:load:if (!%oper.tag) checktag | checkdll
alias checktag %oper.tag = $input(Please set your $chr(37) $+ oper.tag - This appends an ID to the end of your bans. EG: "S" -> G2653-S,e,Oper Tag)
alias checkdll { if (!$isfile(resolv.dll)) { var %r $input(resolv.dll was not found on your system.  Would you like to download it now from www.mistrust.ca/resolv.dll ?,y,-oper inititalization) | if (%r) { run www.mistrust.ca/resolv.dll } } }
dialog whofilter {
  title "/WHO Filter"
  size -1 -1 162 220
  option dbu
  box "/WHO Output", 1, 4 5 157 182
  text "/WHO arguments", 2, 10 13 55 8
  edit "", 3, 10 19 110 10,autohs
  button "Get List", 4, 123 18 32 12
  button "Clear", 5, 10 30 37 12
  button "Remove", 6, 50 30 37 12
  list 7, 10 45 145 115, size extsel hsbar
  text "Filter", 8, 10 165 25 8
  edit "", 9, 25 165 85 10,autohs
  button "Apply", 10, 115 165 37 12
  check "Regular Expression", 11, 15 175 60 10
  check "Exclude", 12, 75 175 35 10
  edit "", 13, 5 190 115 10,autohs
  button "Command", 14, 125 190 32 12
  text "Replace $1 for the nickname Example: /gline $1 Trojans", 15, 5 205 75 13
  button "Help", 16, 80 205 37 12
  button "Done", 17, 120 205 37 12, ok cancel
}

on *:dialog:whofilter:sclick:*:{ 
  if ($did == 4) { 
    ;Sanity check
    if (!$did($dname,3)) { var %r $input(Are you sure you want to /who without parameters?,y,/WHO filter) | if (!%r) { return } }
    who $did($dname,3)
    .enable #whocatch
  }
  if ($did == 5) { did -r $dname 7 }
  if ($did == 6) {
    while ($did($dname,7,1).sel) {
      did -d $dname 7 $did($dname,7,1).sel
    }
  }
  if ($did == 10) {
    filter -if $+ $iif($did($dname,11).state,g) $+ $iif($did($dname,12).state,x) whofilter 7 tempwho.txt $did($dname,9)
    did -r $dname 7
    if ($isfile(tempwho.txt)) {
      loadbuf -o $dname 7 tempwho.txt 
      .remove tempwho.txt
    }
  }
  if ($did == 14) {
    if (!$did($dname,13).text) || ($+($,1) !isin $did($dname,13).text) { var %r $input(You must supply a command to execute with $+($,1),i,/WHO filter) | return }
    var %i 1,%t
    while ($did($dname,7,%i).sel) {
      %t = $gettok($did($dname,7,$did($dname,7,%i).sel).text,1,32)
      $replace($did($dname,13),$+($,1),%t)
      inc %i
    }
  }
  if ($did == 16) { dialog -m help help }
}
alias -l t did -a help 2 $1- $crlf
#whocatch off
raw 352:*:{ 
  hadd -m whotable $4- 
  if ($dialog(whofilter)) { 
    ;me chan ident addy server nick mode # gecos
    if (!$didwm(whofilter,7,$6 *)) { did -a whofilter 7 $6 $3 $4 $9- }
  }
  halt 
}
raw 315:*:{ .disable #whocatch | if ($dialog(whofilter)) { did -z whofilter 7 } | halt }
#whocatch end

dialog help {
  title "your.network.here  Oper Script Help"
  size -1 -1 249 171
  option dbu
  list 1, 5 5 60 150, size
  edit "", 2, 65 5 180 150, read multi return hsbar vsbar
  button "Done", 3, 205 157 37 12, ok cancel
}
on *:dialog:help:init:*:{ helpinit }
on *:dialog:help:sclick:1:{
  help $did($dname,1).seltext
}
alias helpinit {
  did -r help 1
  did -a help 1 /WHO arguments
  did -a help 1 /WHO flags
  did -a help 1 Filter
  did -a help 1 Command
  did -a help 1 Practical Examples
  did -a help 1 Behaviour
}
alias help {
  did -r help 2
  if ($1- == /WHO flags) {
    t /WHO [+|-][acghmnsuCM] [args]
    t  Flags are specified like channel modes, the flags cgmnsu all have arguments
    t  Flags are set to a positive check by +, a negative check by -
    t  The flags work as follows:
    t  Flag a: user is away
    t  Flag c <channel>:       user is on <channel>,
    t  no wildcards accepted
    t  Flag g <gcos/realname>: user has string <gcos> in their GCOS,
    t  wildcards accepted, oper only
    t  Flag h <host>:          user has string <host> in their hostname,
    t  wildcards accepted
    t  Flag m <usermodes>:     user has <usermodes> set on them,
    t  only o/A/a for nonopers
    t  Flag n <nick>:          user has string <nick> in their nickname,
    t  wildcards accepted
    t  Flag s <server>:        user is on server <server>,
    t  wildcards not accepted
    t  Flag u <user>:          user has string <user> in their username,
    t  wildcards accepted
    t  Behavior flags:
    t  Flag M: check for user in channels I am a member of
    t  Flag R: show users' real hostnames (oper only.)
  }
  if ($1- == Filter) {
    t A powerful aspect of the script.
    t The filter runs the current list through itself, returning only the 
    t matched lines. An example of this would be to /who #channel, and filter
    t out all [*]* nicks in it. Regular expressions are supported if you know them.
    t Exclude only removes the matched lines, which could be used to ignore 
    t the dccs in a channel.
  }
  if ($1- == /WHO arguments) {
    t Provides parameters for the /WHO command.
    t /WHO <arguments>
    t See /WHO flags for more information
  }
  if ($1 == Command) {
    t This is where the powerful aspect of the script comes in: Processing.
    t This only works on selected nicks.
    t To use this, type in the command and replace "$1" where the 
    t variable would appear if you were scripting it.
    t For example, to ban the selected nicks for spamming:
    t /gline $1 5h Spamming Clients
    t If you wanted to force them to join a particular channel:
    t /sajoin $1 #bans-r-us
    t Note the slashes are not neccessary.
  }
  if ($1- == Practical Examples) {
    t A flood just occured.  You know all of the nicknames start with:
    t "Suck-" "Fuck-" "Lick-" "Luck-"
    t The script does not clear the who list for each application, so
    t you would put each nickname one by one into the list.  The nickname "Suck-Serv"
    t appears which you know is not a bot.  Select it and press "Remove".
    t On the Command line, you would place gzline2 5h $1 Flood Bot
  }
  if ($1- == Behaviour) {
    t Some quick facts about the script:
    t It does not clear when you do /who searches.
    t It will not add the same nickname twice to the list.
    t Only selected lines in the listbox will be banned.
  }
}

Comments

Sign in to comment.
md5killa   -  Apr 18, 2014

I would really appreciate any comments folks good or bad :/

 Respond  
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.