Sunday, January 2, 2011

correct scapy2 import statement

Problem:


>>> from scapy import all
>>> a = IP()
Traceback (most recent call last):
File "", line 1, in
NameError: name 'IP' is not defined


Solution:


try:from scapy.all import * #Required for Scapy 2.0 and above
except:from scapy import * #Scapy 1.0


(via Tim Eberhard's post. On a side note, here's a pretty uselessly closed bugreport.)

No comments: