What is Pcap4J
v1Pcap4J is a Java library designed for capturing, crafting, and sending network packets. It acts as a Java-oriented wrapper around native packet capture libraries like libpcap, WinPcap, or Npcap using JNA.
Key capabilities include:
- Converting captured packets into Java objects where header fields can be accessed or modified.
- Crafting new packet objects from scratch and sending them to a real network.
- Supporting a wide range of protocols (Ethernet, IPv4/IPv6, TCP, UDP, ARP, DNS, etc.).
- Dumping and reading pcap-formatted files (e.g., Wireshark captures).
- Providing serializable and thread-safe (practically immutable) packet classes.