如何从pcap文件中提取以太网级数据?
我有一些pcap文件,之前我使用tshark结合python来提取源IP地址、时间戳等。
但是,现在我在 Wireshark 中打开这些 pcap 文件。它还包含 VLAN 信息,VID 是我现在要提取的内容。
我在终端中使用tshark -r xx.pcap
,它只能显示tcp级别信息,我无法获取这个VLAN ID。有谁知道如何用Python 来做这件事吗?使用一些库或工具?
I have some pcap files, previously I used tshark combined python to extract source IP address, timestamp, ect.
However, now I open these pcap files in Wireshark. It also contains the VLAN info, VID is the thing I want to extract right now.
I use tshark -r xx.pcap
in the terminal, it can only show the tcp level info, I can not get this VLAN ID. Does anyone one know how to do it in Python? use some library or tool?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
完美的解决方案是 Scapy
在这个例子中,我创建一个带有 vlan 的数据包,然后打印 vlan ID
这个例子展示了如何读取 pcap 文件并打印
经过测试的 VLAN ID,效果非常好。
the perfect solution is Scapy
In this example i create a packet with vlan and then print the vlan ID
and this example shows how to read a pcap file and print the VLAN ID
tested and works perfect.
您可以使用 Scapy 来实现:
未经测试,但可以工作。要学习 scapy,最好是启动它,并使用自动完成功能,并阅读教程:)
You could use Scapy for that:
Not tested, but could work. To learn scappy, best is to launch it, and play with auto completion, and read tutorials :)