Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jNetPcap v2, a libpcap network packet capture using powerful Java API on Linux, Windows, Mac, etc..

License

NotificationsYou must be signed in to change notification settings

slytechs-repos/jnetpcap-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven CentralSonatype Nexus (Snapshots)

jNetPcap Wrapper

Unlock Network Packet Analysis in Java withjNetPcap Wrapper.

jNetPcap Wrapper is alibpcap Java library. This is theversion 2 release of the popularjNetPcap library, originally hosted on [SourceForge.net][sf.net].


Table of Contents

  1. Overview
  2. API Diagram
  3. Documentation
  4. Where are the protocols found in v1?
  5. Examples
  6. Dependencies
  7. Installation
  8. Contact
  9. Compatibility with jNetPcap Version 1
  10. Git Branches
  11. Javadocs API Documentation

Overview

Harness the power of libpcap within your Java applications using jNetPcap Wrapper, a bridge granting seamless access to low-level network monitoring capabilities.

Key Features:

  • Capture and Analyze Network Traffic: Real-time packet interception for detailed analysis.
  • Streamlined Integration: Easily incorporate the library via Maven or manual classpath addition.
  • Intuitive Java API: User-friendly Java interface for network data handling.
  • Packet Capture and Handling: Utilize thePcap class for interface monitoring andPcapPacketHandler for efficient packet processing.
  • Precise Packet Filtering: Apply filters for targeted packet capture.

API Diagram

graph TD    A[Java Application] --> B[jnetpcap-wrapper]    B --> C[Panama/JEP-424 Foreign Function & Memory API]    C --> D[Libpcap / WinPcap / Npcap]    D --> E[Operating System]    E --> F[Network Drivers]    F --> G[Network Interface Cards]
Loading

Documentation


Where are the protocols found in v1?

Protocol support from version 1 is now part ofjnetpcap-sdk, extending the basic wrapper's functionality.


Examples

Capture a Live Packet

voidmain()throwsPcapException {List<PcapIf>devices =Pcap.findAllDevs();try (Pcappcap =Pcap.create(devices.get(0))) {pcap.activate();pcap.loop(1, (Stringmsg,PcapHeaderheader,byte[]packet) -> {System.out.println(msg);        },"Capture Example");    }}

Transmit a Packet With Data-Link Header

voidmain()throwsPcapException {StringrawPacket ="0026622f4787...";byte[]packetBytes =PcapUtils.parseHexString(rawPacket);List<PcapIf>devices =Pcap.findAllDevs();try (Pcappcap =Pcap.create(devices.get(0))) {pcap.activate();pcap.sendPacket(packetBytes);    }}

Statistics Snapshots

voidmain()throwsPcapException,InterruptedException {List<PcapIf>devices =Pcap.findAllDevs();try (Pcappcap =Pcap.create(devices.get(0))) {pcap.activate();for (inti =0;i <5;i++) {System.out.println(pcap.stats());Thread.sleep(1000);        }    }}

How To Run The Examples

Command-line Arguments:

  • Linux:-Djava.library.path=/usr/lib/... --enable-native-access=org.jnetpcap --enable-preview
  • Windows:-Djava.library.path=C:\Windows\... --enable-native-access=org.jnetpcap --enable-preview

Dependencies

Java Dependencies

No external dependencies apart from standard Java modules.

Native Library Dependencies

Requireslibpcap, [Npcap][npcap], or [WinPcap][winpcap].


Installation

Maven Artifact Config

Use the latest version variable in yourpom.xml for easy updates:

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

Using Latest SNAPSHOT Releases

Add this repository:

<repository>    <id>sonatype-snapshots</id>    <url>https://oss.sonatype.org/content/repositories/snapshots</url></repository>

Download Release Package

Latest release:download link


Contact

  • Email:sales@slytechs.com

Compatibility with jNetPcap Version 1

Details in theWiki.


Git Branches

Follows a standardbranching model.


Javadocs API Documentation

The Javadocs are automatically generated and deployed to thegh-pages branch for easy reference. Access theJavadocs here


About

jNetPcap v2, a libpcap network packet capture using powerful Java API on Linux, Windows, Mac, etc..

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp