I am trying to use scapy in python 3.6 to parse pcap files, and of the features I am trying to use is pdfdump.
from scapy.all import *
packets = rdpcap('***path***/nitroba.pcap')
for packet in packets[0:1]:
packet.psdump("isakmp_pkt.eps",layer_shift=1)
And I am getting the following error: "ImportError: PyX and its depedencies must be installed"
Obviously I installed it, and a simple "import pyx" works, but the error persists. I did some digging and found that the problem originates in this code:
def _test_pyx():
"""Returns if PyX is correctly installed or not"""
try:
with open(os.devnull, 'wb') as devnull:
r = subprocess.check_call(["pdflatex", "--version"], stdout=devnull, stderr=subprocess.STDOUT)
except:
return False
else:
return r == 0
when executed, it determines if pyx is installed correctly, but it says "FileNotFoundError: [WinError 2] The system cannot find the file specified".
Ideas?
Scapy runs natively on Linux, Windows, OSX and on most Unixes with libpcap (see scapy's installation page). The same code base now runs natively on both Python 2 and Python 3.
Installation of scapy module: As scapy module is not included in Python3 library by default, we have to add it into our Python library using pip. Execute this command in your Linux terminal to get the scapy module for Python3.
Scapy is a Python interpreter that enables you to create, forge, or decode packets on the network, to capture packets and analyze them, to dissect the packets, etc. It also allows you to inject packets into the network.
In my case (Ubuntu 18, scapy 2.4.3), I had to install pdflatex, i.e.,
sudo apt install texlive-latex-base
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With