Packet Decoding

About read Audio from capture file

Hi All!!

i was looking for the Trhead http://jnetpcap.com/node/195, and i try to use the code showed there but unsucessfuly.. the program read the flows and make the "AU" files, but there are not audible ... y decode wih wireshark and i cant to get the audio file..

u cant help me to idetify what im doing wrong?

thank u Smile

This is my code...


package com.tpmex.jsniffer;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jnetpcap.Pcap;
import org.jnetpcap.PcapBpfProgram;
import org.jnetpcap.PcapTask;
import org.jnetpcap.packet.JPacket;
import org.jnetpcap.packet.JRegistry;
import org.jnetpcap.packet.PcapPacket;
import org.jnetpcap.packet.PcapPacketHandler;
import org.jnetpcap.protocol.voip.Rtp;
import org.jnetpcap.protocol.voip.Sdp;
import org.jnetpcap.protocol.voip.Sip;

import org.jnetpcap.protocol.voip.SipHandler;

/**
 * @author Mark Bednarczyk
 * @author Sly Technologies, Inc.
 */
public class decode    {



public static void main(String[] args) {
        try {
            new decode().SKIP_testRtpAudioExtract();
        } catch (IOException ex) {
            Logger.getLogger(decode.class.getName()).log(Level.SEVERE, null, ex);
        }
}



public static Iterable getIterable(final String file) {
		return new Iterable() {

			public Iterator iterator() {
				return getPcapPacketIterator(file, 0, Integer.MAX_VALUE);
			}

		};
	}




	public static Iterator getPcapPacketIterator(final String file,
			final int start, final int end) {
		return getPcapPacketIterator(file, start, end, null);
	}

Decoded .au file from undecoded Rtp Packets getPayload()

Hi,

I followed the below discussion
http://jnetpcap.org/node/195/

I got .au file but its not playing in Windows media player.
I know that getPayload() method will return undecoded packets, how to decode that packet and how will get ".au" audio file from that Payload raw data.

Can you please help me for the same.

Regards,
Gomathi.K

How to decode undecoded packet which we get from getPayload method from PcapPacket?

Hi,

How to decode and get the .au audio file from undecoded packtes which i got from getPayload() method.

Regards,
Gomathi.K

New to packet capture analysis

Hi,

I am new to packet capturing and analysis and I am trying to use jnetpcap libraries with java code to open file.pcap which was captures by wire shark.

I used the code below, but I don't think that I am on the right track. My requirement is to load the pcap file and convert it to byte[].

      System.out.println("In MAIN");
        StringBuilder sb = new StringBuilder();

        int snaplen = 64 * 1024;           // Capture all packets, no trucation
        int flags = Pcap.MODE_PROMISCUOUS; // capture all packets
        int timeout = 10 * 1000;           // 10 seconds in millis

        Pcap pcap=null;

        try {
            pcap = Pcap.openOffline("C:\\myFile.pcap", sb);

        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("After pcap openOffline");

        if (pcap == null) {
            System.out.println("pcap == null");
            return;
        }
        System.out.println("pcap.src: " + sb.toString());
        
    }

Any help will be appreciated and I will continue to look through the tutorials.

Thanks.

Multiple interface Packet order

Hi everyone,

I listen 2 interface and add all packets to queue (FIFO). When I retrieve from queue, packets are not time based ordered (Packets ordered for same interface). I check my thesis using snoop and wireshark (timestamp value). Is there any way to packets arrived to time ordered not depends on interfaces.
I get packets using PcapPacketHandler class nextPacket functions.

Thanks.