Thursday, January 06, 2005

Traceroute Games

This post is actually taken from and email that I wrote to some friends (late last December) who like this kind of stuff. I went searching through my email, looking for what it was that I did with pydot and graphviz just a while back, and I realized I never blogged about it, and I should have ;-)

A few days after the Winter Solstice, I was screwing around with pydot (graphviz) and a custom traceroute python wrapper I threw together (Update: this is now available
here). I wanted to graphically visualize multiple traceroutes and see the paths shared in common. This is part of a proof-of-concept for some monitoring ideas I have.

The end result was rather cool, the images for which are available here. Here's the Python code that generated the images (though all the heavy lifting is done by the traceroute module, linked to above):


import pydot

from adytum.net import traceroute


hosts = ["www.google.com", "www.amazon.com", "www.aol.com", "www.cnet.com",
"www.yahoo.com"]
linkedHosts = []

for host in hosts:
trace = traceroute.Trace(host, useDNS=True, queries=5)
trace.run()
domains = trace.results.getLinkedDomains(subdomainLimit=2)
linkedHosts.extend(domains)

graph = pydot.graph_from_edges(linkedHosts, directed=True)
graph.write_png("traceroutes.png", prog="dot")

No comments: