Libpcap wrapper

Steganography using LibCap

Hai,I'm a beginner using libcap. I want to know is it possible implementing steganography using libpcap?
I send a UDP streaming audio with JMF and I want to capture the data and modify it before I send it again. On the receiver side I capture the data and extract the message. I need to modify the optional field on header so I can send the flag.
How could I possibly do that with libpcap?
Thanks for any help Smile

Corrupted JMemoryPacket after Pcap.loop()


Hello jNetPcap-Community,

Upon creating a static JMemoryPacket followed by reading a sufficiently large number of PcapPackets using Pcap.loop(), the state of my original JMemoryPacket seems to get corrupted.

The library throws the below IndexOutOfBoundsException. Has anyone else seen this problem before?

Is this a bug with the jnetpcap library, or is it expected that a JMemoryPacket's state will get corrupted after calling Pcap.loop() a sufficiently large number of times?

If this is expected behavior, then how should I be creating JMemoryPackets such that they won't eventually become corrupted?

    java.lang.IndexOutOfBoundsException: Invalid [0,14,14) range.
        at org.jnetpcap.nio.JMemory.peer(Unknown Source)
        at org.jnetpcap.nio.JBuffer.peer(Unknown Source)
        at org.jnetpcap.packet.JPacket.getHeaderByIndex(Unknown Source)
        at com.pcap.IndexOutOfBoundsTest.testPcapPacket1(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(
        at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(

JNetPCap: Can't read list of devices on windows 7

Hi all,
I've try to run the basic example of JNetPCap but i've got this error: "Can't read list of devices, error is ".
I'm running Windows 7 64 bit and i don't find anything that can help...How can i make it work?

Thank in advance!

tcp packet sending

I have created TCP packet using jnetpcap. I want to send this packet to remote machine.On this remote machine one java program will be running , this program contains severSocket which is in listening mode.
How to send this packet on remote machine and decode it there??

pcap loop infinite

Hello ,
I am using pcap.loop_infinite in my program. Basically, i am receiving packets continuously through ethernet in and displaying it in my Java UI. But what happens is after some 10 12 hours, there are no more packets on my UI. Everything is frozen and i am not able to make any transmissions as well. this happens all the time.

macSend = new Timer();
macSend.schedule(new TimerTask() {

public void run() {
}, 0, Global.SECOND_ONE/10);

while (ethernetLoop) {
try {
LogManager.performLogEntry(new Date().toString() + " " + "Entered PCAP Try Block");
LogManager.performLogEntry(new Date().toString() + " " + pcap.loop(packetLimit, jpacketHandler, "jNetPcap rocks!"));

} catch (Exception e) {
LogManager.performLogEntry(new Date().toString() + " " + "Entered PCAP Catch Block" + " " + pcap.getErr());
// System.out.println("Connection Error");
System.out.println("Connection Error " + e.getMessage());
finally {
LogManager.performLogEntry(new Date().toString() + " " + "Entered PCAP Finally Block");


Inside the while loop , where i have opened up a new Pcap loop, i have set packet limit to be 60000 and then it refreshes (i guess). also, i have saved this into a file so that i can check whats happening exactly. It prints 0 for a long time (0 is for success) but after a some certain hours, it stops printing these 0s to the file and there are no more packets received. Can any one help me out as to why this is happening and how can i rectify this.
Thanks in advance


Syndicate content