简体   繁体   English

使用Scapy生成数据包PDF时,如何抑制PyX警告消息?

[英]How to suppress PyX warning messages when using Scapy to generate a PDF of a packet?

I am generating a PDF of a packet using Scapy's pdfdump method : 我正在使用Scapy的pdfdump方法生成数据包的PDF:

from scapy.layers.inet import ICMP, IP

packet = IP(dst="192.168.111.1") / ICMP()
packet.pdfdump("report.pdf")

When this code is executred, there are lots of messages printed out from the PyX library. 执行此代码后, PyX库会打印出许多消息。

PyX executes tex with args ['--output-directory', '/tmp/pyx1ojf7_d9'] located at /usr/bin/tex
PyX filelocator found 10pt.lfs by method internal
PyX executes kpsewhich with args ['--format', 'vf', 'cmss10'] located at /usr/bin/kpsewhich
PyX filelocator failed to find cmss10 of type ('vf',) and extensions {'', '.vf'}
PyX executes kpsewhich with args ['--format', 'tfm', 'cmss10'] located at /usr/bin/kpsewhich
PyX filelocator found cmss10 by method kpsewhich at /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmss10.tfm
PyX executes kpsewhich with args ['--format', 'vf', 'cmtt10'] located at /usr/bin/kpsewhich
PyX filelocator failed to find cmtt10 of type ('vf',) and extensions {'', '.vf'}
PyX executes kpsewhich with args ['--format', 'tfm', 'cmtt10'] located at /usr/bin/kpsewhich
PyX filelocator found cmtt10 by method kpsewhich at /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmtt10.tfm
PyX executes kpsewhich with args ['--format', 'map', 'pdftex.map'] located at /usr/bin/kpsewhich
PyX filelocator found pdftex.map by method kpsewhich at /var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map
PyX executes kpsewhich with args ['--format', 'type1 fonts', 'cmss10.pfb'] located at /usr/bin/kpsewhich
PyX filelocator found cmss10.pfb by method kpsewhich at /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb
PyX executes kpsewhich with args ['--format', 'afm', 'cmss10'] located at /usr/bin/kpsewhich
PyX filelocator found cmss10 by method kpsewhich at /usr/share/texlive/texmf-dist/fonts/afm/public/amsfonts/cm/cmss10.afm
PyX executes kpsewhich with args ['--format', 'type1 fonts', 'cmtt10.pfb'] located at /usr/bin/kpsewhich
PyX filelocator found cmtt10.pfb by method kpsewhich at /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb
PyX executes kpsewhich with args ['--format', 'afm', 'cmtt10'] located at /usr/bin/kpsewhich
PyX filelocator found cmtt10 by method kpsewhich at /usr/share/texlive/texmf-dist/fonts/afm/public/amsfonts/cm/cmtt10.afm

Is there a way to disable or suppress these messages so they are not printed out? 有没有办法禁用或禁止显示这些消息,使它们不被打印出来? The PyX manual doesn't have much on how to tune the verbosity of these messages. PyX手册没有太多关于如何调整这些消息的详细程度的信息。

This output is created using the standard python logging framework at the logging level logging.INFO. 使用标准python日志记录框架在日志记录级别logging.INFO上创建此输出。 Such logging output is silenced by default, as the default is logging.WARNING (IIRC). 默认情况下,此类日志记录输出会静音,因为默认情况下为logging.WARNING(IIRC)。 Anyway, just adjust your logging level to prevent the notice from bugging you. 无论如何,只要调整您的日志记录级别,以防止通知困扰您。 Also, you may have a look at the pyxinfo call, which is the solution provided by PyX to enable this output. 另外,您可能会看到pyxinfo调用,这是PyX提供的启用此输出的解决方案。 (Maybe this is called somewhere by the library you're using, and you want to disable that.) Note, that this behavior of PyX is also documented at http://pyx.sourceforge.net/manual/text.html#debugging (也许这是您正在使用的库在某处调用的,您想禁用它。)请注意,PyX的这种行为也记录在http://pyx.sourceforge.net/manual/text.html#debugging

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM