Charles Reid
0d2c52bfca
|
8 years ago | |
---|---|---|
.gitignore | 8 years ago | |
ClassicPcapExample.java | 8 years ago | |
LICENSE | 8 years ago | |
README.md | 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