5

我正在尝试在 python 3.6 中使用 scapy 来解析 pcap 文件,而我正在尝试使用的功能是 pdfdump。

from scapy.all import *
packets = rdpcap('***path***/nitroba.pcap')
for packet in packets[0:1]:
  packet.psdump("isakmp_pkt.eps",layer_shift=1)

我收到以下错误:“ImportError: PyX and its depedencies must be installed”

显然我安装了它,并且一个简单的“import pyx”可以工作,但错误仍然存​​在。我做了一些挖掘,发现问题出在这段代码中:

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

执行时,它会确定 pyx 是否安装正确,但会显示“FileNotFoundError: [WinError 2] The system cannot find the file specified”。

想法?

4

2 回答 2

4

就我而言(Ubuntu 18,scapy 2.4.3),我必须安装 pdflatex,即

sudo apt install texlive-latex-base  
于 2020-07-02T03:58:40.910 回答
2

我自己得到了答案 - 当我进入 scapy 命令行界面时,它说我需要安装 PyX 的依赖项 miktex,所以我做到了。第二个错误看起来像一个错误 - 看起来 packet.py 模块中缺少“import os”语句,但第 531 行中有一个 os.startfile。

我添加了它,它起作用了:)

于 2018-06-18T22:52:47.423 回答