Geolocator

By LIQUID_NiTrO on Jun 24, 2005

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
  }
}

Comments

Sign in to comment.
cheft   -  Oct 06, 2005

This just stopped working for me, now all i get is \"unauthorized access\"
help pls

 Respond  
BlackNinja   -  Jul 08, 2005

Oh and it doesnt seem to recognize proxies. I tried 2 reliable proxies, 1 transparent and one anonymous. Both showed as \"No\"
But thats DNS\'s problem :)

 Respond  
BlackNinja   -  Jul 08, 2005

It didn\'t work for me at first, until I removed \"www.\" from the site name. So for those of you having problems, try deleting it.
I made a remotes version of this script too, works great.

 Respond  
LIQUID_NiTrO   -  Jun 25, 2005

Fixed now. Sorry; I made some minor changes before uploading it and forgot to test it again. It was just an \"elseif\" that should have been an \"if\"

 Respond  
DarthReven   -  Jun 25, 2005

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 }
}
}

 Respond  
aeros   -  Jun 25, 2005

This script doesn\'t seem to work.. just says tracing ip... after u did /trace ip... ~_~

 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.