IP Address Whois Lookup
Platform: mIRC
Published Oct 21, 2011
Updated Jun 25, 2012
Simple IP Whois Check. This script is self-explanatory as always.
Usage: !track <IP Here>
UPDATE - 6/24/12 - Revised the incorrect match under sockread due to source code change. I removed the regsubex stripping method and the unncessary while loop.
UPDATE - 6/25/12 - Added bold in the output to make the IP result easier to spot and read.
on *:exit:{
if ($file(whois).shortfn) .remove $v1
}
on *:sockclose:w...*:{
.play $gettok($sock($sockname).mark,2,124) whois 2000
}
on *:text:$($iif(!track* iswm $strip($1),$1)):*:{
if ($file(whois).shortfn) write -c $v1
if ($regex($strip($2),/((\d{1,3}\.){3}\d{1,3})/S)) {
var %ipinfo = $regml(1)
if ($play(#)) || ($play($nick)) {
.notice $nick Please wait until I've finished the IP lookup!
halt
}
.msg $iif(#,#,$nick) Please wait while I fetch the IP info...
var %w $+(w...,$r(1,$ticks))
sockopen %w www.fr2.cyberabuse.org 80
sockmark %w $+(%ipinfo,|,$iif(#,#,$nick))
halt
}
.notice $nick That's not an IP address. Syntax: !track <IP>
}
on *:sockopen:w...*:{
if ($sockerr) {
$gettok($sock($sockname).mark,2,124) * Error Connecting to Website!
halt
}
var %? = sockwrite -nt $sockname
var %?? = $+(IP=,$gettok($sock($sockname).mark,1,124),&OK=OK&OK=OK&dns=OK)
%? POST /whois/?page=whois_server HTTP/1.1
%? Host: $sock($sockname).addr
%? Referer: $+(http://,$sock($sockname).addr,/whois/?page=whois_server)
%? Content-Type: application/x-www-form-urlencoded
%? Connection: close
%? Content-Length: $len(%??)
%? $+($crlf,%??)
}
on *:sockread:w...*:{
if ($sockerr) {
$gettok($sock($sockname).mark,2,124) * Error Reading Website!
halt
}
if (error isin %whois) {
.msg $gettok($sock($sockname).mark,2,124) Invalid IP Address!
halt
}
var %whois, %data = (Infos|Country|Abuse E-mail|Source)
sockread %whois
if ($chr(37) !isin %whois) && ($regex($v2,/ $+ %data $+ /)) {
if ($regex(%whois,/(.*) $+ $+($chr(60),br,$chr(62)) $+ /)) {
write whois $regsubex($remove($regml(1),:),$&
/ $+ %data $+ /g,$+($chr(2),\1 :,$chr(2)))
}
}
}