Skip to main content

Welcome to PcapPlusPlus!

A multi-platform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use.

Capture and Send Network Traffic

PcapPlusPlus enables capturing and sending network packets through easy-to-use C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, NPcap, DPDK and PF_RING

Learn More
  • DPDK
  • PF_RING
  • LIBPCAP
  • WINPCAP
  • NPCAP

Decode and Forge Packets

PcapPlusPlus enables decoding and forging capabilities for a large variety of network protocols

Learn More
// parse the raw packet into a parsed packet
pcpp::Packet parsedPacket(&rawPacket);

// check if it's an IPv4 packet
if (parsedPacket.isPacketOfType(pcpp::IPv4)) {
// extract source and dest IPs
pcpp::IPv4Address srcIP =
parsedPacket.getLayerOfType()->getSrcIPv4Address();
pcpp::IPv4Address destIP =
parsedPacket.getLayerOfType()->getDstIPv4Address();

// print source and dest IPs
std::cout <<
"Source IP is: " << srcIP << std::endl <<
"Dest IP is: " << destIP << std::endl;

Super Fast!

PcapPlusPlus is designed to be efficient and lightweight. It enables amazingly fast packet processing with minimum overhead

View Benchmarks

Multi Platform Support

PcapPlusPlus is fully supported on Windows, MacOS, Linux, Android and FreeBSD. You can download pre-built binaries for each platform or build it from source. PcapPlusPlus is available in popular package managers such as Homebrew and Conan

View Installation Guide
  •   Windows
  •   Linux
  •   Apple
  •   FreeBSD
  •   Android

Read and Write Packets to Files

PcapPlusPlus provides an easy-to-use interface for reading and writing network packets into files.It supports the most popular file formats which are PCAP and PCAPNG

Learn More
// create a pcap file reader
pcpp::PcapFileReaderDevice pcapReader("input.pcap");
pcapReader.open();

// create a pcapng file writer
pcpp::PcapNgFileWriterDevice pcapNgWriter("output.pcapng");
pcapNgWriter.open();

// raw packet object
pcpp::RawPacket rawPacket;

// read packets from pcap reader and write pcapng writer
while (pcapReader->getNextPacket(rawPacket)) {
pcapNgWriter.writePacket(rawPacket);
}

Packet Reassembly

PcapPlusPlus contains unique implementation of packet reassembly techniques.

TCP Reassembly which supports TCP retransmission, out-of-order TCP packets and missing TCP data.

IP Fragmentation and Defragmentation to create and reassemble IPv4 and IPv6 fragments

Learn More