Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyX not installed correctly when using scapy

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?

like image 1000
SockworkOrange Avatar asked Jun 18 '18 16:06

SockworkOrange


People also ask

Does Scapy work on Windows?

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.

How do you use Scapy in 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.

What is Scapy used for?

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.


1 Answers

In my case (Ubuntu 18, scapy 2.4.3), I had to install pdflatex, i.e.,

sudo apt install texlive-latex-base  
like image 95
Roei Schus Avatar answered Sep 27 '22 20:09

Roei Schus