- Notifications
You must be signed in to change notification settings - Fork9
jNetPcap v2, a libpcap network packet capture using powerful Java API on Linux, Windows, Mac, etc..
License
slytechs-repos/jnetpcap-wrapper
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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].
- Overview
- API Diagram
- Documentation
- Where are the protocols found in v1?
- Examples
- Dependencies
- Installation
- Contact
- Compatibility with jNetPcap Version 1
- Git Branches
- Javadocs API Documentation
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 the
Pcap
class for interface monitoring andPcapPacketHandler
for efficient packet processing. - Precise Packet Filtering: Apply filters for targeted packet capture.
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]
- Wiki pages: Comprehensive user guides and examples.
- Javadocs: Detailed API documentation.
Protocol support from version 1 is now part ofjnetpcap-sdk, extending the basic wrapper's functionality.
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"); }}
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); }}
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); } }}
- 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
No external dependencies apart from standard Java modules.
Requireslibpcap, [Npcap][npcap], or [WinPcap][winpcap].
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>
Add this repository:
<repository> <id>sonatype-snapshots</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url></repository>
Latest release:download link
- Email:
sales@slytechs.com
Details in theWiki.
Follows a standardbranching model.
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..