Help with newtwork packet sniffer
Trying to write a network packet sniffer using jpcap in eclipse. At runtime i get this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: jpcap.JpcapCaptor.getDeviceList()[Ljpcap/NetworkInterface;
at jpcap.JpcapCaptor.getDeviceList(Native Method)
at pktSniffer.main(pktSniffer.java:20)
Code :
import jpcap.*;
import jpcap.packet.Packet;
import jpcap.PacketReceiver;
public class pktSniffer implements PacketReceiver {
public void receivePacket(Packet packet){
System.out.println(packet);
}
public static void main(String[] args) throws java.io.IOException{
NetworkInterface[] lists=jpcap.JpcapCaptor.getDeviceList();
System.out.println("\n\t\t***Network Sniffer***\n");
System.out.println("Found the following devices : ");
for(NetworkInterface s: lists)
{
System.out.println("Name: " + s.name +" Description: " + s.description);
}
JpcapCaptor jpcap=JpcapCaptor.openDevice(JpcapCaptor.getDeviceList()[1],1000,false,20);
jpcap.loopPacket(-1,new pktSniffer());
}
}
Re: Help with newtwork packet sniffer
Have you looked up the definition of that error in the API doc?
Look for the class: UnsatisfiedLinkError
Re: Help with newtwork packet sniffer
Why are you trying to sniff packets? Is it a Java exercise or is it just to see what packets are being transmitted?
If your goal is just to sniff packets to see them, Wireshark is a great tool to use.
Wireshark Go deep.
Re: Help with newtwork packet sniffer
Actually was tyring to sniff packets so i could sniff out and save the packets (cookies)