Libpcap wrapper

building jnetcap with android project

Hello All

is there a way to import JnetPcap to work with android project ?

i find page that says to build the jni folder

i tried it , the ndk-build failed

is there a good way to have this work ?

Using jnetPcap on android studio or eclipse step by step

Hi dear friends ,I am a biginer at jnetPcap on android , I have a big chalange to use jnetPcat in android application.
First of all I have a question,Can I use jnetPcap for making a packet and send to over of network(2nd layer)?
If I can , How do I careate packet with jnetpcap on android? My IDE is android studio.
I downloaded on this site after extarcted this file , I add jnetpcap.jar to my android application after that I can call all the classes,but when I want run my app I faced to an error.
My sample code is :

public class PcapAndroidActivity extends Activity {

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
int size = 100;
Ethernet wEth;
byte[] sourceMac = {};
byte[] destMac = {};
Ip4 wIp4;
byte[] bytes = {};
byte[] dIP = {};
byte[] sIP = {};

try {
Process p = Runtime.getRuntime().exec("su");
JPacket wPacket = new JMemoryPacket(size);
wPacket.setUShort(12, 0x0800);
wEth = wPacket.getHeader(new Ethernet());
int headersize = 14;
wPacket.setUByte(14, 0x40 | 0x05);
wIp4 = wPacket.getHeader(new Ip4());
wIp4.length(500 - wEth.size());
headersize += 20;
catch (Exception ex)

decoding tags, values and keys from pcap file using java or jnetpcap

Hello everyone,

I am new for jnetpcap. I have newer version of wireshark 2.0.1,
I am trying to capture offline packet bytes string, and wireshark itself decodes pcap files like and display as follows
(I have only mentioned those values, keys and tags which I am looking for)
Form item: "Type_0_3" = "6"
Form item: "Value_0_3" = "National Instruments"
Form item: "Tag_0_4" = "1005000"
Form item: "Tag_0_5" = "1006000"
Form item: "Type_0_5" = "6"
Form item: "Value_0_5" = "cRIO-9074"
Form item: "Tag_0_28" = "1050000"
Form item: "Type_0_28" = "6"
Form item: "Value_0_28" = "NI Real-Time VxWorks-PPC603 6.3"

I have attached screen shot of it,

Can you please give me some hints, can jnetpcap decodes and displays the result like above, I have not seen any example

I will appreciate help and suggestion.

openOffline Method to access from Android Internal Storage

Hi everyone,

I am using JnetPcap library to extract the packets from a Mobile Wireshark application required for Android project analysis. I have to capture the IP address from the pcap file and display the same on the Google Maps.

I am facing an issue reading the Internal Storage of the Android phone using the openOffline method... Can this method be used for Android Internal Storage File Directory ?? The same code is working if the directory path is specified in Windows OS running on a PC....

Any inputs would be highly appreciated...

Please find below the code for the same.

package appprofiler.appprofilerv1;

* Created by soory_000 on 11/30/2015.

import android.os.Environment;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jnetpcap.Pcap;
import org.jnetpcap.nio.JMemory;
import org.jnetpcap.packet.JFlow;
import org.jnetpcap.packet.JFlowKey;
import org.jnetpcap.packet.JFlowMap;
import org.jnetpcap.packet.JPacket;
import org.jnetpcap.packet.JPacketHandler;
import org.jnetpcap.packet.JScanner;
import org.jnetpcap.packet.PcapPacket;
import org.jnetpcap.protocol.tcpip.Http;
import org.jnetpcap.protocol.tcpip.Tcp;

public class IPExtract {
final static List ipaddress = new ArrayList();
private static String FILENAME;

public IPExtract(String Filename) {
this.FILENAME = Filename;

public static void main(String[] args) {
final StringBuilder errbuf = new StringBuilder();
final Pcap pcap = Pcap.openOffline(FILENAME, errbuf); // While trying to debug I am getting a Library error
if (pcap == null) {

Using Jnetpcap in Spring


I'm Trying to use Jnetpcap in a Web Application. It is working fine with the first startup of the Application Server.
i.e., The Native Libraries are registering Correctly and it able to parse the Input files.

But, once I do redeployment of code or enable/disable of the WAR file. (i.e., Application server is not restarted, only the application is redeployed) it fails to startup, the native libraries are not registered and throwing

java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)

Once, wee restart the Application Server, It works Fine.

Please let me know how to un-register the Native Library?

I'm Trying some thing like this..


But it doesn't Help....

Syndicate content