Introduction

Pcap provides a packet processing library for rapid development on top of JVM languages.

Hello Pcap!

"Hello pcap!" implementation in different JVM languages.

var service = Service.Creator.create("PcapService");
try (var pcap = service.live(service.interfaces(), new DefaultLiveOptions())) {
  pcap.loop(10, (args, header, buffer) -> {
    System.out.println("Args     : " + args);
    System.out.println("Header   : " + header);
    System.out.println("Packet   : " + buffer);
  }, "Hello pcap!");
}

Version History

Pcap is using semantic versioning: https://semver.org

Project Status

Supported platforms

  • Linux (Tested)

  • Mac OS (Tested)

  • Windows (Tested)

  • FreeBSD (Tested)

  • Other OSes that supported by both Libpcap and JNA (Untested).

Requirements

  • Java 7+

  • Libpcap for Unix or Npcap for Windows

Java module system with java 9+

Pcap can be used in modular java 9+ applications with specific module name listed below:

  • pcap-spi: pcap.spi

  • pcap-jdk7: pcap.jdk7

  • pcap-common: pcap.common

  • pcap-codec: pcap.codec

Disclimers

  • Every types, methods, or fields annotated with @Incubating might be changed or removed at any time.

  • Every types, methods, or fields annotated with @Incubating does not imply that the functionality being tested.

  • Calling the @Restricted method might crash your app if you use it incorrectly. Make sure you know what you're doing with it.

Last updated