A Java packet sniffer that uses jNetPcap to sniff packets and examine headers.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Charles Reid 0d2c52bfca adding classic examples and updating readme to mention new examples 8 years ago
.gitignore adding classic examples and updating readme to mention new examples 8 years ago
ClassicPcapExample.java adding classic examples and updating readme to mention new examples 8 years ago
LICENSE Initial commit 8 years ago
README.md adding classic examples and updating readme to mention new examples 8 years ago

README.md

Java Packet Sniffer

This repository contains Java code useful for sniffing packets with jNetPcap and friends.

Using jNetPcap requires an underlying C or other library that can deal with packets, since Java doesn't have the functionality built-in to do this itself.

Capturing packets from a live interface requires the wirless device be put into monitor mode before the script is run.

Packets can also be read and processed from a pcap file, created from a separate application.

ClassicPcapExample

Script that connects to the wifi device and captures exactly six packets from it before it shuts down.

This script was successfully executed 12/1/2016 at 7:30 PM.

This script requires the following files to be present in the same directory:

  • jnetpcap.jar
  • libjnetpcap.so

Then you can compile the program by specifying the class path on the command line:

javac -cp '.:jnetpcap.jar' ClassicPcapExample.java 

You must specify a library path for Java, so it knows where to look for the .so file. If the .so file is in the same directory, you can use this command to run the program:

java -Djava.library.path='.:libjnetpcap.so' -cp '.:jnetpcap.jar' ClassicPcapExample