Skip to content
@slytechs-repos

Sly Technologies

High-performance analysis and security solutions. Transforming data into actionable insights for unparalleled network protection and optimization.

Network Packet Capture in Java

Welcome to Sly Technologies main repository! If you are interested in creating network applications, we have many of the tools you will need to quickly develop your products or complete projects on time. Incorporating our tried and tested libraries into your production environments and applications can help save both time and money.

SDK Architecture

Our SDKs are organized into a hierarchical structure that promotes modularity and reuse:

Core Platform

  • jnet-platform - Core runtime and support functionality used by all SDKs
    • Base APIs and utilities
    • Packet Language (JNPL) for filter expressions
    • System tables and configuration
    • Common data structures and protocols
    • Thread and memory management

Current Products (Available Now)

jnetpcap-sdk

Java wrapper and API for libpcap with high-level protocol support:

  • Native libpcap integration
  • Packet capture and transmission
  • Protocol header access
  • Live and offline capture
  • IP reassembly
  • Protocol services

protocol-sdk

Extensive protocol support including:

  • TCP/IP protocol family
  • Web protocols (HTTP, TLS)
  • Telecom protocols
  • Database protocols
  • Microsoft protocols
  • Media protocols (Voice/Video)

Coming in Q1 2025

jnetworks-sdk

High-performance multi-CPU packet processing:

  • Multi-CPU packet distribution
  • Hardware acceleration support
  • Zero-copy architecture
  • Advanced stream processing
  • High-speed packet capture
  • In-line packet forwarding
  • Traffic shaping

jnetntapi-sdk

Napatech SmartNIC integration:

  • SmartNIC hardware acceleration
  • High-speed packet processing
  • Hardware-assisted filtering
  • Advanced NIC features

jnetdpdk-sdk

Intel DPDK integration:

  • DPDK packet processing
  • High-performance networking
  • Poll-mode drivers
  • Memory management

Getting Started

1. Basic Packet Capture (jNetPcap SDK)

First, add the dependencies:

<dependency>
    <groupId>com.slytechs.jnet.jnetpcap</groupId>
    <artifactId>jnetpcap-api</artifactId>
    <version>${jnetpcap.version}</version>
</dependency>

<dependency>
    <groupId>com.slytechs.jnet.protocol</groupId>
    <artifactId>protocol-tcpip</artifactId>
    <version>${protocol.version}</version>
</dependency>

Smallest possible example:

try (var pcap = NetPcap.openOffline("capture.pcap")) {
    pcap.loop(System.out::println);
}

Advanced example with protocol handling:

try (var pcap = NetPcap.openOffline("capture.pcap")) {
    // Initialize protocol headers once for reuse
    final Ethernet ethernet = new Ethernet();
    final Ip4 ip4 = new Ip4();
    final Tcp tcp = new Tcp();
    final Http http = new Http();

    // Configure packet formatting
    pcap.setPacketFormatter(new PacketFormat());
    
    pcap.loop(packet -> {
        // Headers bind to packet's native memory
        if (packet.hasHeader(ethernet))
            System.out.println(ethernet);

        if (packet.hasHeader(ip4))
            System.out.println(ip4);

        if (packet.hasHeader(tcp))
            System.out.println(tcp);

        if (packet.hasHeader(http))
            System.out.println(http);
    });
}

2. High Performance Processing (jNetWorks SDK)

<dependency>
    <groupId>com.slytechs.jnet.jnetworks</groupId>
    <artifactId>jnetworks-api</artifactId>
    <version>${jnetworks.version}</version>
</dependency>

Multi-CPU capture example with multiple buffers and streams:

try (PcapFramework framework = new PcapFramework(PcapFramework.VERSION)) {
    
    // Configure multi-port setup with streams and buffers
    try (Config config = framework.createConfig()) {
        // Enable multiple ports
        config.getPortsConfig()
                .enablePorts(PortIds.portSet(0, 1, 2, 3))
                .disablePorts(PortIds.portRange(4, 2));

        // Configure receive streams
        var rxSettings = new StreamSettings()
                .setRxBufferCount(4)    // Multiple receive buffers
                .setRxStreamCount(4);    // Multiple stream processors

        // Setup streams with hash-based distribution
        int[] streamIds = config.getBufferConfig()
                .setupRxStreams(rxSettings);

        // Configure TCP filtering with hash distribution
        config.getNetworkConfig()
                .assignFilter("tcp")
                .priority(20)
                .ids(streamIds)
                .hash(HashMode.HASH_5_TUPLE_SORTED);
    }

    // Start capture with multiple processing threads
    try (NetTransceiver capture = framework.createTransceiver()) {
        // Fork stream processors (4 worker threads)
        capture.forkRxStreams(stream -> {
            RxPacket packet = new RxPacket();
            long totalSize = 0;

            while (stream.isActive()) {
                if (stream.get(packet, 100))
                    continue;

                totalSize += packet.length();
                stream.release(packet);
            }

            System.out.printf("Stream processed %d bytes%n", totalSize);
        }, 4);

        // Fork buffer processors (2 worker threads)
        capture.forkRxBuffers(buffer -> {
            RxSegment segment = buffer.newSegment();
            long totalSize = 0;

            while (buffer.isActive()) {
                if (buffer.get(segment, 100) || segment.isEmpty())
                    continue;

                totalSize += segment.byteSize();
                buffer.release(segment);
            }

            System.out.printf("Buffer processed %d bytes%n", totalSize);
        }, 2);

        // Start capture and wait
        capture.startCapture();
        capture.awaitCaptureStart();
        capture.awaitCaptureStop();
    }
}

License Information

Our modules are licensed as follows:

  • jnetpcap-wrapper: Licensed under Apache v2 License
  • All other modules: Licensed under Sly Technologies Free License
    • 5 free developer installations
    • One-time distribution license fee
    • No royalties
    • Commercial support available (1 or 5 year terms)

About Sly Technologies

We specialize in high-performance network packet capture and analysis solutions for Java. Our libraries are tried and tested in production environments, helping developers save time and money.

Contact Information

Additional Resources

Pinned Loading

  1. jnetpcap-sdk jnetpcap-sdk Public

    PCAP capture/transmission with protocol enabled network packet dissection, analysis and reassembly

    2 2

  2. protocol-sdk protocol-sdk Public

    Network protocol modules/packs for core, web, database, microsoft and telco family of protocols

    1

Repositories

Showing 10 of 17 repositories
  • protocol-api Public

    Core Protocol pack consisting of many common protocols

    slytechs-repos/protocol-api’s past year of commit activity
    Java 4 0 0 0 Updated Jan 12, 2025
  • platform-api Public

    Base runtime API and implementation classes

    slytechs-repos/platform-api’s past year of commit activity
    Java 0 0 0 0 Updated Jan 5, 2025
  • jnetpcap-api Public

    A protocol enabled jNetPcap with IPF reassembly

    slytechs-repos/jnetpcap-api’s past year of commit activity
    Java 3 2 1 0 Updated Dec 26, 2024
  • platform-systables Public

    Native system table access from Java such as ARP, DNS and network routing tables

    slytechs-repos/platform-systables’s past year of commit activity
    Java 0 0 0 0 Updated Dec 26, 2024
  • jnetpcap-sdk Public

    PCAP capture/transmission with protocol enabled network packet dissection, analysis and reassembly

    slytechs-repos/jnetpcap-sdk’s past year of commit activity
    2 2 2 0 Updated Dec 25, 2024
  • compiler-pcap-filter Public

    Packet filter expression compiler that generated Berkley Packet Filter (BPF) binary OPCODES

    slytechs-repos/compiler-pcap-filter’s past year of commit activity
    Java 1 0 0 0 Updated Dec 25, 2024
  • platform-examples Public

    Various examples of platform-sdk usage

    slytechs-repos/platform-examples’s past year of commit activity
    Java 0 0 0 0 Updated Dec 25, 2024
  • jnet-sdk Public

    All jNet project aggregator - builds runtime, pcap, protocols, jNetWorks, DPDK and Napatech NTAPI SDKs

    slytechs-repos/jnet-sdk’s past year of commit activity
    0 0 0 0 Updated Dec 25, 2024
  • jnetpcap-example Public

    Various jNetPcap v2 and jNetPcap Pro examples

    slytechs-repos/jnetpcap-example’s past year of commit activity
    Java 2 1 0 0 Updated Dec 25, 2024
  • platform-sdk Public

    Runtime and utilities required by all other modules

    slytechs-repos/platform-sdk’s past year of commit activity
    0 0 0 0 Updated Dec 23, 2024

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…