pcap ファイルの構造
2015/3/27 ネットワーク パケットを読む会 (仮) 7
pcap_file_header
pcap_pkthdr
packet data
pcap_pkthdr
packet data
pcap_pkthdr
packet data
………
~
pcap_file_header
bpf_u_int32 magic
u_short
version_major
Libpcap major version.
u_short
version_minor
Libpcap minor version.
bpf_int32
thiszone
gmt to local correction
bpf_u_int32
sigfigs
accuracy of timestamps
bpf_u_int32
snaplen
max length saved portion of each pkt
bpf_u_int32
linktype
data link type (LINKTYPE_*)
2015/3/27 ネットワーク パケットを読む会 (仮) 8
pcap_pkthdr
2015/3/27 ネットワーク パケットを読む会 (仮) 9
struct timeval
ts
time stamp
bpf_u_int32
caplen
length of portion present
bpf_u_int32
len
length this packet (off wire)
pcap ファイルのデータ構造
2015/3/27 ネットワーク パケットを読む会 (仮) 10
0 1 2 3 4 5 6 7 8 9 A B C D E F
D4 C3 B2 A1 02 00 04 00 00 00 00 00 00 00 00 00
00 00 04 00 01 00 00 00 9B 55 13 55 3B 67 05 00
0B 01 00 00 0B 01 00 00 F8 72 EA 99 72 81 00 06
0000
0000
0000
0000 : 0030
: 0000
: 0010
: 0020
frame #1
pcap_pkthdr
caplen
pcap_pkthdr
len
actuial frame data
distination MAC source MAC
snaplen linktype ts
pcap_file_header
pcap_file_header
frame #1
magic version_major version_minor thiszone sigfigs
………
~