September 2016

Exporting project in production

Hello,

Just finished building a sniffer, to analyse some of my network traffic, and I managed to make it work on my development computer.
Unfortunatly, I can't make it work on the computer I want.
I installed WinPcap_4_1_3, and java, and that's the terminal message I received :

hello
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J
at com.slytechs.library.NativeLibrary.dlopen(Native Method)
at com.slytechs.library.NativeLibrary.(Unknown Source)
at com.slytechs.library.JNILibrary.(Unknown Source)
at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at org.jnetpcap.Pcap.(Unknown Source)
at javaapplication1.PacketLoader.(PacketLoader.java:43)
at javaapplication1.JavaApplication1.main(JavaApplication1.java:32)
Appuyez sur une touche pour continuer...

Netbeans provided me a jar file i'm running, and a library folder which contains jnetpcap.rar.

Would be a big help if you could help me to make it work.

Thanks a lot,

fred

Extract packet payload and store in a string

I need to extract payload of a packet and want to store in a string. How this can be done. Currently I am doing like :

import org.jnetpcap.Pcap;
import org.jnetpcap.packet.JPacket;
import org.jnetpcap.packet.JPacketHandler;

public class Hexdump
{
public static void main(String[] args)
{
String FILENAME1 = "/home/mayank/Pcaps/DNS_Skype.pcap";
final StringBuilder errbuf = new StringBuilder();
final Pcap pcap1 = Pcap.openOffline(FILENAME1, errbuf);

if (pcap1 == null)
{
System.err.println(errbuf);
return;
}

pcap1.loop(-1, new JPacketHandler()
{
public void nextPacket(JPacket packet, StringBuilder errbuf)
{
String hexdump = packet.toHexdump(packet.size(), false, true, false);
System.out.println(hexdump);
}
}, errbuf);

}
}

In this way payload is not coming in a proper format. Please help.