家政网站建设,微信开发服务商,wordpress首页只显示摘要不要文章,网站建设与用户需求分析(初稿1. 简述
pcap文件头中的magicNum是来标识pcap文件文件头和包头字节序和应用是否一致的。 在标准情况下为0xa1b2c3d4。如果相反则说明需要调换字节序。
一般格式
Global Header
Packet Header
Packet Data
Packet Header
Packet Data
....pcap文件头格式
typedef struct pca…1. 简述
pcap文件头中的magicNum是来标识pcap文件文件头和包头字节序和应用是否一致的。 在标准情况下为0xa1b2c3d4。如果相反则说明需要调换字节序。
一般格式
Global Header
Packet Header
Packet Data
Packet Header
Packet Data
....pcap文件头格式
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;pcap报文头格式
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;2. magicNum对照
不同应用也可以自己写入不同的magicNum这里说的主要是pcap自己的格式。
2.1 pcapng
pcapng即pcap next generation,s是pcap新的格式扩展。 它对应的magic number为0a0d0d0a
2.2 mpcap
magicNum为0xa1bcd34, 包头也得到了相应的扩充多了八个字节。
结构体定义就变成了这样
typedef struct pcaprec_modified_hdr {struct pcaprec_hdr_s pcaphdr; /* the regular header */uint32_t ifindex; /* index, in *capturing* machines list ofinterfaces, of the interface on which thispacket came in. */uint16_t protocol; /* Ethernet packet type */uint8_t pkt_type; /* broadcast/multicast/etc. indication */uint8_t pad; /* pad to a 4-byte boundary */
} mpcaprec_hdr_t;
2.3 npcap
支持纳妙捕获精度的时间戳Libpcap 1.5之后的可以读取这种文件。 对应的magic number为0xa1b23c4d
2.4 其他
Nokia pcapAIXIXIA
有些应用会更改这个pcap的值就参考tsharktshark magic number了。
参考
libpcap formattshark magic number