Introduction
pcapng is the successor to the PCAP capture format, and the default format of Wireshark. Like PCAP it records network packets with the time each was seen, but it can also record several network interfaces in one file, each with its own link type, and carry comments, name resolution, statistics and the keys needed to decrypt TLS traffic.
The format is built from blocks that a reader can skip if it does not understand them, so new kinds of information can be added without breaking older software.
Structure
Every block has the same frame: a 4-byte block type, a 4-byte total length, the body, and the total length again, so the file can be read backwards as well as forwards. Bodies are padded to a multiple of 4 bytes, and most blocks end with options, each a code, a length and a value.
The file starts with a Section Header
Block, type 0x0A0D0D0A. Its first field is the byte-order magic
0x1A2B3C4D, which tells a reader whether the section is big- or
little-endian, followed by the version, 1.0. An
Interface Description
Block (type 1) follows for each interface, giving its link type and snapshot length.
Packets are then stored in Enhanced
Packet Blocks (type 6), each naming its interface and giving a 64-bit timestamp, the
captured and original lengths and the packet bytes.
Other blocks hold name resolution
(type 4), interface statistics (type 5) and decryption secrets (type 10).
0Section Header Block0A 0D 0D 0A, length, byte-order magic, version28 bytes or more…Interface Description Block link type, snapshot length, optionsone per interface…Enhanced Packet Block interface, timestamp, lengths, packet datarepeated…Other blocks name resolution, statistics, decryption secretsoptional
Not described
Known, not yet covered
- Reference: the layouts of the Hone (0x101, 0x102) and Sysdig (0x201 to 0x213) blocks, which their projects document and open-source code reads.
- Viewer: the Hone, Sysdig, IRIG (0x7) and ARINC 429 (0x8) blocks are named and shown as bytes; custom blocks and custom options show the private enterprise number and then bytes, because their content belongs to the vendor.
- Viewer: the packets inside the blocks are taken apart by the same protocol dissectors as classic pcap (protocols); registered link types the dissectors do not know are shown as named bytes, and decryption secrets are listed but not used to decrypt anything.
Unknown
- Reference: the layout of the IRIG timestamp and ARINC 429 blocks: the specification table cites a vendor request and no public document.
Links
Software
- Wireshark and TShark – free network analyser that writes pcapng by default, with the dumpcap, editcap and mergecap tools (Windows, macOS, Linux)
- tcpdump – command-line packet capture tool that reads pcapng files (Linux, macOS)
Developers
Reference
- PCAP Now Generic (pcapng) Capture File Format – the IETF draft specification