All pastes #1971949 Raw Edit

Untitled

public text v1 · immutable
#1971949 ·published 2010-10-24 15:56 UTC
rendered paste body
; This is a replacement for the built in mIRC /dns. It works just like /dns except
; this allows you to receive much more detailed information, for example:
; mIRC's /dns:
;
;[15:43] * Looking up microsoft.com
;[15:43] * Resolved microsoft.com to 207.46.230.218
;
; Advanced /dns:
;[15:44] * Looking up microsoft.com
;[15:44] * Resolved microsoft.com to 207.46.230.218, 207.46.230.219, 207.46.230.220, 207.46.134.155, 207.46.134.190
;
; It allows you to get a list of all IPs that the host resolves to rather than just the first.


ON *:DNS:{
  if ($dns(0) == 0) {
    echo $color(other) -ts * Unable to resolve $iif($iaddress,$iaddress,$dns(0).addr)
  }
  else {
    var %numhosts $dns(0), %host = 0
    var %hosts
    while (%host < %numhosts) {
      inc %host 1
      set %hosts %hosts $iif($dns(1) == $dns(1).ip,$dns(%host).addr,$dns(%host).ip) $+ $chr(44)
    }
    echo $color(other) -ts * Resolved $dns(1) to $left(%hosts,$calc($len(%hosts)-1))
  }
  halt
}