A Java library for capturing, crafting, and sending network packets via native pcap libraries.
Pcap4J is a Java library that enables capturing, crafting, and sending network packets by wrapping native pcap libraries (libpcap, WinPcap, or Npcap) via JNA. It provides Java-oriented APIs for low-level network operations, allowing developers to manipulate packet headers, create custom packets, and interact directly with network interfaces.
Java developers building network monitoring tools, packet analyzers, simulators (like SNMP simulators), or any application requiring raw packet manipulation across Windows, Linux, and UNIX systems.
Pcap4J offers a pure Java solution for packet manipulation with extensive protocol support, thread-safe immutable packet objects, and the ability to extend protocol support without modifying the library. It fills the gap left by older, discontinued Java pcap wrappers.
A Java library for capturing, crafting, and sending packets.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports essential protocols like Ethernet, IPv4/IPv6, TCP, UDP, and ICMP, enabling detailed packet crafting and analysis as listed in the Features section.
All built-in packet classes are serializable and practically immutable, ensuring safe concurrent access in Java applications.
Allows adding custom protocol support without modifying the core library, facilitating adaptation to specialized network needs.
Reads from and writes to pcap-formatted files (e.g., Wireshark captures), enabling seamless integration with existing network analysis tools.
Requires separate installation of libpcap, WinPcap, or Npcap and administrator privileges, complicating setup and deployment across platforms.
Using Npcap on Windows needs manual tweaks like PATH adjustments or system property settings, adding complexity compared to WinPcap.
While extensible, the core library lacks support for some modern protocols (e.g., QUIC), requiring custom implementation for advanced use cases.