Python 2.7 Scapy 2.4
我尝试运行scapy的pdfdump()演示,但得到OSError如下:
/>>> a=rdpcap("/home/zhangqiang/test.pcap")
/>>> a
<test.pcap: TCP:1053 UDP:4 ICMP:0 Other:0>
/>>> a[423].pdfdump(layer_shift=1)
我收到了如下错误
ERROR: pdfdump(): executing 'acroread' failed
Traceback (most recent call last):
File "/home/zhangqiang/.local/lib/python2.7/site-packages/scapy/packet.py", line 526, in pdfdump
subprocess.Popen([conf.prog.pdfreader, fname])
File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
我搜索了这个问题,据说需要模块shlex。 所以我导入了模块,但是引发了另一个错误。 好像TeX不起作用。
/>>> import shlex
/>>> a[423].pdfdump(layer_shift=1)
still waiting for tex after 5 of 60) seconds...
still waiting for tex after 10 (of 60) seconds...
still waiting for tex after 15 (of 60) seconds...
still waiting for tex after 20 (of 60) seconds...
still waiting for tex after 25 (of 60) seconds...
still waiting for tex after 30 (of 60) seconds...
still waiting for tex after 35 (of 60) seconds...
still waiting for tex after 40 (of 60) seconds...
still waiting for tex after 45 (of 60) seconds...
still waiting for tex after 50 (of 60) seconds...
still waiting for tex after 55 (of 60) seconds...
the timeout of 60 seconds expired and tex did not respond.
We try to finish the dvi due to an unhandled tex error
still waiting for tex after 5 (of 60) seconds...
still waiting for tex after 10 (of 60) seconds...
still waiting for tex after 15 (of 60) seconds...
still waiting for tex after 20 (of 60) seconds...
still waiting for tex after 25 (of 60) seconds...
still waiting for tex after 30 (of 60) seconds...
still waiting for tex after 35 (of 60) seconds...
still waiting for tex after 40 (of 60) seconds...
still waiting for tex after 45 (of 60) seconds...
still waiting for tex after 50 (of 60) seconds...
still waiting for tex after 55 (of 60) seconds...
the timeout of 60 seconds expired and tex did not respond.
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/zhangqiang/.local/lib/python2.7/site-packages/scapy/packet.py", line 521, in pdfdump
canvas = self.canvas_dump(**kargs)
File "/home/zhangqiang/.local/lib/python2.7/site-packages/scapy/packet.py", line 635, in canvas_dump
pt = pyx.text.text(XSTART, (YTXT-y)*YMUL, r"\font\cmssfont=cmss10\cmssfont{%s}" % proto.name, [ pyx.text.size.Large])
File "/usr/lib/python2.7/dist-packages/pyx/text.py", line 1201, in text
raise e
TexResultError: TeX didn't respond as expected within the timeout period (60 seconds).
The expression passed to TeX was:
\ProcessPyXBox{\Large{}\font\cmssfont=cmss10\cmssfont{Ethernet}%
}{82}%
\PyXInput{86}%
After parsing the return message from TeX, the following was left:
\*! Interruption.
<*>
? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
(cut after 5 lines, increase errordebug for more output)
我如何解决这个问题?
答案 0 :(得分:0)
您必须将conf.prog.pdfreader
设置为要用于打开PDF文件的程序。例如:conf.prog.pdfreader = "evince"
。