From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Pcap (libpcap savefile)" |
|---|
| claim | "The pcap file header is 24 bytes: magic, version 2.4, thiszone, sigfigs, snaplen, linktype." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Pcap (libpcap savefile)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "pcap_file_header" |
|---|
| size | "24" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "magic" |
|---|
|
| offset | "0x4" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "version_major" |
|---|
| notes | "2" |
|---|
|
| offset | "0x6" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "version_minor" |
|---|
| notes | "4" |
|---|
|
| offset | "0x8" |
|---|
| size | 4 |
|---|
| type | "int32_t" |
|---|
| name | "thiszone" |
|---|
| notes | "unused, 0" |
|---|
|
| offset | "0xC" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "sigfigs" |
|---|
| notes | "unused, 0" |
|---|
|
| offset | "0x10" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "snaplen" |
|---|
|
| offset | "0x14" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "linktype" |
|---|
| notes | "LINKTYPE_*; upper bits carry extra fields" |
|---|
|
|
|---|
| endianness | "mixed: the byte order of the machine that wrote the file; the reader detects it from magic (0xA1B2C3D4 microsecond or 0xA1B23C4D nanosecond when it reads as-is, byte-swapped otherwise)" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "struct pcap_file_header" |
|---|
| repo | "https://github.com/the-tcpdump-group/libpcap" |
|---|
| commit | "ba925f7" |
|---|
| path | "pcap/pcap.h" |
|---|
| lines | "204-212" |
|---|
|
| type | "source" |
|---|
| detail | "sf-pcap.c: TCPDUMP_MAGIC 0xa1b2c3d4 and NSEC_TCPDUMP_MAGIC 0xa1b23c4d; if the magic read as-is is not one of them it is byte-swapped and tried again, swapped=1, then the header fields are byte-swapped; 0xa1b2cd34 (Kuznetzov) is a modified-record variant read with the same header" |
|---|
| repo | "https://github.com/the-tcpdump-group/libpcap" |
|---|
| commit | "ba925f7be2ad4cc90ff00ea249310679094221a5" |
|---|
| path | "sf-pcap.c" |
|---|
| lines | "71-99, 225-280" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "pcap file header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T17:20:13.023Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T16:36:49.392Z" |
|---|
| summary | "Byte order was missing: the header is in the byte order of the host that wrote the file, detected from the magic; libpcap byte-swaps the header when the magic reads swapped. Also nanosecond magic…" |
|---|
| changed | |
|---|
|
|
|---|