问题标签 [pyshark]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
4504 浏览

python-3.x - Python 3.4.3 - 错误 Pyshark capture.sniff()

这是我的代码:

现在这里是错误:

我正在使用 python 3.4.3 运行 mac os 10.10.x 安装了 pysharksudo pip3 install pyshark

0 投票
1 回答
2897 浏览

macos - 在 python 3.5 上安装 pyshark

我已经在 mac os x (el capitan) 上安装了 python 3.5。我想在 python 中导入 pyshark 模块,但出现错误。我安装了 pyshark 要求,例如 (logbook, lxml, trollies, py) 但我无法导入pyshark模块。

导入pyshark模块错误:

导入 trollies 模块也有错误:

任何人都可以帮助我吗?我不知道是什么问题。

0 投票
0 回答
850 浏览

python - Pyshark / Tshark 没有通过所有数据包

使用 pyshark 处理 openfpc pcap 文件(1gb)时出现问题。当我使用(在控制台中,作为根):

即使我确定文件中有 ftp 数据包,它也不会打印任何内容。如果我这样去:

它打印“赢”。我的问题是:

1)我们如何解释这种行为?

2) 我怎样才能看到没有过滤器的 ftp 数据包?

编辑:我看到这只发生在使用 .pcap 文件时。第一个代码在使用从 wireshark 网站下载的 .cap 文件时完美运行。我觉得很奇怪,因为 pyshark 使用 TShark,并且应该能够读取 pcaps 没问题。

谢谢

0 投票
1 回答
2493 浏览

python - 如何连续向kafka发送数据?

我正在尝试将数据(用 tshark 嗅探的数据包)连续发送到 kafka 代理/消费者。

以下是我遵循的步骤:

1.启动zookeeper:

2.启动kafka服务器

3.启动kafka消费者

4.编写以下python脚本将嗅探到的数据发送给消费者:

但这保留在 procuder 终端上并输出:

没有任何东西被转移给消费者。

我知道我可以用来pyshark在 python 上实现 tshark:

但是我不知道如何不断地将捕获的数据包从生产者发送到消费者。有什么建议吗?

谢谢!

0 投票
2 回答
2106 浏览

python - pyshark 无法在 windows 7 (python) 上捕获数据包

我想使用 pyshark 捕获数据包。但我无法在 Windows 7 上捕获数据包。

这是我的python代码


这是结果



实时捕获为 0 个数据包。我不知道怎么回事。请帮我。

0 投票
1 回答
561 浏览

python-2.7 - 在 python 2.7 上使用 pyshark 遇到 lxml.etree.XMLSyntaxError

这确实是一个用python编写的简单脚本,我可以在Linux上正常运行它。但是当我将它移到 Windows 时,出现了一个奇怪的错误。我希望有所帮助。

在运行代码之前,我对环境做了一些准备:
1.安装Microsoft Visual C++ Compiler for python 2.7
2.安装python 2.7.11 3.pip
install pyinstaller
4.easy_install pyshark
下面是我的部分代码。

以下是错误信息:
Traceback(最近一次调用最后一次):
文件“packet_offline_analysis.py”,第 36 行,在 analysis_method
中用于 cap 中的数据包:
文件“C:\Python27\lib\site-packages\pyshark-0.3.6.1- py2.7.egg\pyshark\capture\capture.py”,第 173 行,在 _packets_from_tshark_sync
self._get_packet_from_stream(tshark_process.stdout, data, psml_structure=psml_structure))
文件“C:\Python27\lib\site-packages\trollius- 1.0.4-py2.7-win32.egg\trollius\base_events.py”,第 300 行,在 run_until_complete
返回 future.result()
文件“C:\Python27\lib\site-packages\trollius-1.0.4-py2 .7-win32.egg\trollius\futures.py",第 287 行,结果
引发 self._exception
lxml.etree.XMLSyntaxError:输入不正确的UTF-8,表示编码!
字节:0xD6 0xD0 0xB9 0xFA,第 6 行,第 58 列

0 投票
1 回答
381 浏览

python - Python - PyShark 是否返回相对序列号?

我知道 WireShark 是基于 Tshark 构建的,并且 WireShark 在 GUI 中显示 TCP 对话的相对序列号。

我知道 PyShark 是建立在 Tshark 之上的。PyShark 是否返回 TCP 对话的相对序列号?

谢谢!

0 投票
1 回答
617 浏览

python - 是否可以在 PyShark 中访问数据包的 hexdump?

pyshark用来打开和解析pcap文件。目前我已经能够访问数据包字段。但我似乎找不到访问hexdump每个数据包值的方法。有没有办法做到这一点?

0 投票
1 回答
2027 浏览

python - faster solution? : dpkt or pyshark via Cython

I'm looking to use dpkt or pyshark coupled with cython, to speed up parsing of a lot of data (GBs) in a pcap file.

I wondered if anyone has run dpkt with cython OR pyshark with cython and could share the speed increases with me? Im specifically looking to increase speed of a python script, just not sure if dpkt or pyshark is better coupled with cython.

Thank you!

0 投票
1 回答
1325 浏览

python-3.x - 打印 DNS 信息时出现 Pyshark 属性错误

获取数据包的 DNS 信息时,我在使用 pyshark 时遇到了一些问题。我正在使用python 3。

我的代码如下所示:

错误如下所示:

我什至不打印有关数据包的任何信息,只打印错误。