Granted Wish: Traceroute pickling in scapy

A friend of mine sent in a script that worked for him.

#!/usr/bin/env python

import scapy, pickle

# pickler
tr, un = scapy.traceroute([""])
f = open("/tmp/pickle-out", "w")
p = pickle.Pickler(f)

# unpickler
f = open("/tmp/pickle-out", "r")
u = pickle.Unpickler(f)
tr = u.load()
print " Original tr:----------------------------"

I still couldn’t get this to work on my Ubuntu box. However in a later chat with my colleague Elphine I found out that Ubuntu had it’s own package for scapy. So I used apt-get to install scapy and this time it DID work. This is great since now I can start sticking objects into a database and move on to the next task of combining arbitrary traceroutes for the purposes of making graphs. I’m still curious why this didn’t work when I simply downloaded the code and executed it. Once I get some working code I’ll post it here.

Post a Comment

You must be logged in to post a comment.