Fun with IP Mapping
We recently set up an old machine at work to play the part of an “ops warboard” . . . basically, a Firefox session with the tab-slideshow module, paging through screens of Big Sister status lamps. I got to thinking, that one very cool thing to do, is to set up a map, with little dots on it that light up when people log in to our web application.
There is a web site to map IPs to geographic information: hostip.info. I yanked IPs from web logs, and wrote a script to query the web site for Latitude and Longitude, and then delved into the complexities of xplanet.
To prove my own understanding, I hacked up this:
WARNING: Do not visit this link! Some Hungarian asshat linked to it in a message forum and stole a bunch of server bandwidth so it is currently serving alternate content. (Sorry.)
http://dannyman.toldme.com/scratch/animated.gif
That’s a 24-frame animated gif of hourly hits to my web site from last Wednesday. I’m hoping to write a script to generate such things automatically. For a “real time” deal it is a matter of getting the IPs you want to map from the web logs to the mapper. I’m thinking some minor daemon who tails logs and perhaps send RPC pings when it sees a “new” IP address. Where “new” is “new within the past five minutes” . . . that gets converted into geo coordinates, and the map is refreshed every so often. Not quite “real time” but close enough to look cool.