采集pcap报文数据的软件为:Wireshark


抓包应该是每个技术人员掌握的基础知识,无论是技术支持运维人员或者是研发,多少都会遇到要抓包的情况,用过的抓包工具有fiddle、wireshark,作为一个不是经常要抓包的人员,学会用Wireshark就够了,毕竟它是功能最全面使用者最多的抓包工具。
Wireshark(前称Ethereal)是一个网络封包分析软件。网络封包分析软件的功能是撷取网络封包,并尽可能显示出最为详细的网络封包资料。Wireshark使用WinPCAP作为接口,直接与网卡进行数据报文交换。
为了安全考虑,wireshark只能查看封包,而不能修改封包的内容,或者发送封包。
什么人会用到wireshark
1. 算法工程师、网络管理员会使用wireshark来检查网络问题
2. 软件测试工程师使用wireshark抓包,来分析自己测试的软件
3. 从事socket编程的工程师会用wireshark来调试
4. 听说,华为,中兴的大部分工程师都会用到wireshark。
总之跟网络相关的东西,都可能会用到wireshark.
获取所得pcap数据文件之后,我们接下来进行解析
import scapy
from scapy.all import *
from scapy.utils import PcapReader
packets=rdpcap("D:/你的pcap存储位置.pcap")
for data in packets:
if 'UDP' in data:
s = repr(data)
print(s)
print(data['UDP'].sport)
break
执行结果(涉密,不方便演示):

网友评论