BlueHell mIRC Script — File Browser

BlueHellmIRCScriptv1.0 / BlueHellmIRCScriptv1.0 / BlueHellScript / System / ipcheck.mrc

ipcheck.mrc — 2.12 KB — Download this file

; Name: IPCheck
; Version: 1.00
; Date: 9 Aug 2006
; Author: chenghwa (ipcheck@chenghwa.us)
; Location: Singapore
; IP Address Lookup Webservice: http://www.hostip.info/about.html
; Dedicated to Galaxynet, Austnet & Pacific Internet Singapore IRC Team

menu nicklist {
  IPCheck: /ipcheck $$1
}

menu query {
  IPCheck: /ipcheck $$1
}

menu channel {
  IPCheck: /ipcheck $?="Enter Nickname/Host/IP Address: "
}

menu status {
  IPCheck: /ipcheck $?="Enter Nickname/Host/IP Address: "
}

menu menubar {
  IPCheck: /ipcheck $?="Enter Nickname/Host/IP Address: "
}

On *:Unload: { 
  echo 2 -a Thank you for using IPCheck!
  Unset %~~IP2.* 
}

alias ipcheck {
  set %~~IP2.DNS $true
  echo 2 -a -
  if ($regex($$1, \.)) set -U0 %~~IP2.address $$1
  else {
    whois $$1 $$1
    set -U0 %~~IP2.address $remove($address($$1,2), $chr(33), $chr(42), $chr(64))
    if (%~~IP2.address == $null) {

      echo 2 -a - Please try again.
      return
    }
    echo 2 -a * Nickname: $$1 
  }
  if ($regex(%~~IP2.address, [a-z]|[A-Z])) {
    .dns -c %~~IP2.address
  }
  else {
    $IP2(%~~IP2.address)
  }
}

alias -l IP2 {
  set %~~IP2.ip $$1
  sockclose IP2
  sockopen IP2 api.hostip.info 80 
}


on 1:DNS:{
  if (%~~IP2.DNS) { 
    if ($raddress == $null) {
      echo 2 -a Unable to resolve hostname
      halt
    }
    var %n = $dns(0)
    echo 2 -a * Host: %~~IP2.address
    while (%n > 0) {
      $IP2($dns(%n).ip) 
      dec %n
    }
  }
}

On *:sockopen:IP2: {
  Sockwrite -tn $Sockname GET $+(http://api.hostip.info/get_html.php?ip=,%~~IP2.ip,) HTTP/1.1
  Sockwrite -tn $Sockname Host: api.hostip.info $+ $Str($Crlf,2)
  Sockwrite -tn $Sockname User-Agent: mIRC $version [chenghwa]
  Sockwrite -tn $Sockname $Crlf
  echo 2 -a * IP: %~~IP2.ip
}

On *:Sockread:IP2: {
  If ($Sockerr) { Sockclose $Sockname | Echo -a An error has occured: $Sockerr | Halt }
  Sockread -f %~~IP2.sockread 
  while ($sockbr != 0) {
    if ((Country* iswm %~~IP2.sockread) || (City* iswm %~~IP2.sockread)) {
      echo 2 -a * %~~IP2.sockread
    }
    Sockread -f %~~IP2.sockread 
  }
  echo 2 -a -
}