Hello, I’m Zac, a student at University of Victoria majoring in Geomatics (a joint Computer Science and Geography program). Today I’ll be writing about one of the first programs I wrote years ago. Have you ever been curious about the path your packets take geographically, between your computer and the sites you visit? The unix command line utility traceroute (or tracert on windows) shows you this information as a series of IP addresses, from your home router to destination. It works…

“[…]by sending packets with gradually increasing TTL value, starting with TTL value of one. The first router receives the packet, decrements the TTL value and drops the packet because it then has TTL value zero. The router sends an ICMP Time Exceeded message back to the source. The next set of packets are given a TTL value of two, so the first router forwards the packets, but the second router drops them and replies with ICMP Time Exceeded. Proceeding in this way, traceroute uses the returned ICMP Time Exceeded messages to build a list of routers that packets traverse, until the destination is reached and returns an ICMP Echo Reply message” (Comer, 2004)

What my code does is parse the IP addresses from the output with regular expressions, sends them off to an online geoip translation service, then writes out the results into a single .csv that can be read in by mapping software such as ArcGIS online webmaps. Here is an example, going to www.sysselmannen.no, which is the website of the Governor of Svalbard.

Here’s code for this script:

At present the shell script isn’t terribly portable (it would likely not work with Mac’s builtin version of bash), as it relies on a newer function called “mapfile” that maps command output to an array. It should work on any *nix system however, and it might work on Windows through their linux subsystem and “Bash on Ubuntu on Windows.” All the same, it shouldn’t be too difficult to port or modify. My next article will likely focus on the cheap and fascinating RTL-SDR dongle and the cool things you can do with it, like intercepting NOAA weather satellite broadcasts for weather maps, and mapping boat and plane positions with AIS and ADS-B signals pulled from the ether.

Until next time,
Zac


References:

Comer, Douglas (2004). Computer Network and Internets with Internet Applications. Pearson Education, Inc. pp. 360–362. ISBN 0131433512.