Today, someone sent me a link to a Homemade Datacenter. The pictures are mildly interesting, but what is more so is the banner ad at the bottom. It advertises a popular dating site called “Adult Friend Finder". “So What?", you’re probably asking yourself. Well, what’s interesting is that it seems to be really good at figuring out your location from an IP address.
For example, I’m using Verizon DSL and my IP’s whois information returns Reston, VA. The hostname is “herntx.dsl-w.verizon.net” (probably referring to Hearne, Texas, about 25 miles away). So my guess if I was just trying to figure out where I’m at would be in hearne. The traceroute to home doesn’t reveal anything interesting along the way other than Hearne is probably wired to Dallas. Even so, Adult Friend Finder correctly deduces that I’m in College Station.
Now I have no idea where they get the data, but I figured it would be handy next time I’m travelling. So I wrote a perl scripty to tell me:
#!/bin/perl
use LWP::Simple;
my $locationServer="http://banners.adultfriendfinder.com/piclist";
my $locationData = get($locationServer) or die “Could not retrieve data from server";
$locationData =~ /near (.*?)</
And sure enough, it works:
[bill@ppppowerbook-airport]~$ perl findme.pl
College Station
And for this server:
[bill@aggienerds]~$ perl findme.pl
Dallas
It looks like they also have support for grabbing the state and country, but I’ll need to add another line or two to deal with that. (They display other places with the state and country attached, but not your own.)
Note: You might need to install LWP::Simple with perl -MCPAN -e ‘install LWP::Simple’ using sudo or root to run this: