wireshark文件pcap的格式
来源:互联网 发布:office2016激活工具mac 编辑:程序博客网 时间:2024/04/30 13:54
pcap格式文件组成
pcap文件由Global Header、Packet Header及Packet Data组成,其中Packet Data即为需要根据网络协议解释的数据。
Global Header的定义
typedef struct pcap_hdr_s { guint32 magic_number; /* magic number */ guint16 version_major; /* major version number */ guint16 version_minor; /* minor version number */ gint32 thiszone; /* GMT to local correction */ guint32 sigfigs; /* accuracy of timestamps */ guint32 snaplen; /* max length of captured packets, in octets */ guint32 network; /* data link type */} pcap_hdr_t;
通过python解析一个pcap文件,得到的前6个words数据:a1b2c3d4、00040002、00000000、00000000、0000ffff、00000065 主要关心最后一个word对应协议格式DLT的数据,0x65 101对应表示后面数据类型为IP包格式(DLT可以参考https://www.tcpdump.org/linktypes.html)。
Packet Header的定义
typedef struct pcaprec_hdr_s { guint32 ts_sec; /* timestamp seconds */ guint32 ts_usec; /* timestamp microseconds */ guint32 incl_len; /* number of octets of packet saved in file */ guint32 orig_len; /* actual length of packet */} pcaprec_hdr_t;
其中incl_len小于等于orig_len,orig_len为抓取的时候的真实数据包长度,incl_len为存储的数据包长度(不等情况的使用,还未考虑过)。pcap文件得到一个PacketHeader示例值000000b5、0ad26fc4、00000033、00000033,示例中的incl_len和orig_len是相等的为0x33=51个字节长度。
数据和wireshark解析示例
注意示例中的文本数据和wireshark解析数据存在大小端不一致的映射关系,所以33000045在解析时是按照45 00 00 33顺序进行的。
参考
pcap文件格式:https://wiki.wireshark.org/Development/LibpcapFileFormat
DLT:https://www.tcpdump.org/linktypes.html
wireshark源代码地址:https://github.com/wireshark/wireshark
阅读全文
0 0
- wireshark文件pcap的格式
- 使用PYTHON解析Wireshark的PCAP文件
- wireshark--pcap包格式分析
- 使用wireshark的tshark工具把pcap导出csv格式
- 构建tcpdump/wireshark pcap文件
- pcap/cap文件关联wireshark
- pcap文件的格式和分析
- pcap文件头的组织格式
- 使用wireshark分析tcpdump出来的pcap文件
- PCAP文件存储格式
- Wireshark的Pcap文件格式分析
- Wireshark的Pcap文件格式分析
- 简洁的Pcap文件格式--Wireshark
- wireshark pacp文件的格式
- WireShark抓包的pcap文件格式分析
- WireShark抓包的pcap文件格式分析
- Java之Pcap文件解析(一:Pcap格式分析)
- ns3之PCAP tracing文件命名格式
- 12-19笔记
- python3 阿里云短信发送Demo
- java编程,通过终端实现一个用户密码验证
- 一文快速掌握 Git 用法(Git介绍及使用流程)
- 信号处理中,为什么要引入复数
- wireshark文件pcap的格式
- Openstack各组件服务功能介绍
- Java序谈之HashSet类和TreeSet类
- java 行为模式 备忘录模式
- Asp.NET Core+ABP框架+IdentityServer4+MySQL+Ext JS之数据迁移
- C#类中的引用成员field
- 无线网络和移动网络--计算机网络自顶向下笔记(七)
- 线性代数 02.03 逆矩阵
- The Swift Programming Language