This snippet no longer works due to changes to the dnsstuff.com system that prevent it from being accessed by a non-human.
Uses dnsstuff.com to give you the location of a given IP address. Most IP addresses will work. Syntax is /trace [IP]. It will also echo an extra line if the IP is a known proxy server.
--EDIT--
Sorry guys I made some changes after posting this and assumed it would work, but I left one thing that was supposed to be an "if" as an "elseif".
It works now, I'm sure.
--UPDATE 6/11/05--
Fixed stupid little debug line I had in there. In reference to BlackNinja's comment, it WONT work for me if I remove the www from dnsstuff.com so I don't know what that's about...
alias trace {
%myexpr = /(\d{1,3}.){3}\d{2,3}/
if ( !$regex($1,%myexpr) ) {
echo $colour(other) -a * Note: $1 is not a valid IP; attempting to trace anyway...
}
else {
echo $colour(info) -a * Tracing $1 $+ ...
}
sockopen geo. $+ $1 www.dnsstuff.com 80
sockmark geo. $+ $1 $1
}
on *:SOCKOPEN:geo.*: {
if ( $sockerr ) {
echo $colour(info) -a * ERROR in SOCKOPEN: $sockerr $sock($sockname).wsmsg
halt
}
sockwrite -n $sockname GET /tools/city.ch?ip= $+ $sock($sockname).mark HTTP/1.1
sockwrite -n $sockname Host: www.dnsstuff.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite $sockname $crlf
}
on *:SOCKREAD:geo.*: {
sockread %tmp
tokenize 32 %tmp
if ( $gettok(%tmp,1,32) == Country: ) {
set -u2 %countr $2-
}
elseif ( $gettok(%tmp,1,32) == City: ) {
echo $colour(info2) -a * $sock($sockname).mark is located in $+([,%countr,]) $2-
}
elseif ( $gettok(%tmp,1-2,32) == Known Proxy? ) {
if ( $3 == Yes ) { echo $colour(info2) -a * $sock($sockname).mark is a known proxy server }
sockclose $sockname
}
}
i got it to work though i had to change a few things:
alias trace {
echo 12 -a [Geolocator] - Tracing $1 $+ ...
sockopen trace www.dnsstuff.com 80
sockmark trace $1
}
on :SOCKOPEN:trace: {
sockwrite -n $sockname GET /tools/city.ch?ip= $+ $sock($sockname).mark HTTP/1.1
sockwrite -n $sockname Host: mIRC $+(v,$version)
sockwrite $sockname $crlf
}
on :SOCKREAD:trace: {
sockread %tmp
if ($gettok(%tmp,1,32) == IP:) { echo 4 -a [Geolocator] - $gettok(%tmp,2,32) }
else {
tokenize 32 %tmp
if ($1 == Country:) { echo 12 -a [Country] - $2- }
if ($1-2 == Country Code:) { echo 12 -a [Country Code] $3- }
elseif ($1 == City:) { echo 12 -a [City] - $2- }
elseif ($1 == Currency:) { echo 12 -a [Currency] - $2- }
elseif ($1-2 == Private IP?) { echo 12 -a [Private IP] - $3 }
elseif ($1-2 == Known Proxy?) { echo 12 -a [Known Proxy] - $3 | echo 4 -a [Geolocator] - Trace Complete | halt }
}
}