[英]How to suppress PyX warning messages when using Scapy to generate a PDF of a packet?
[英]PyX not installed correctly when using scapy
我正在尝试在 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”。
想法?
就我而言(Ubuntu 18,scapy 2.4.3),我必须安装 pdflatex,即,
sudo apt install texlive-latex-base
我自己得到了答案 - 当我进入 scapy 命令行界面时,它说我需要安装 miktex,它是 PyX 的一个依赖项,所以我这样做了。 第二个错误看起来像是一个错误 - 看起来 packet.py 模块中缺少“import os”语句,但第 531 行中有一个 os.startfile。
我添加了它,它起作用了:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.