style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7505528228218001"
data-ad-slot="1225241371">

May 2016

IP address, Request Response for UDP Packet

Is there a way to get a formatted IP, request Response for a captured UDP DNS packet?

What I am doing doesn't give a proper solution.

public void nextPacket(PcapPacket packet, String user) {

                if (!packet.hasHeader(udp)) {
                    return; // not a UDP package, skip
                }
                // Process Output
                if (packet.hasHeader(udp)) {
                    System.out.println("Got UDP Packet");
                    if (packet.getHeader(udp).source() == 53) {
                        System.out.println("This packet is a Response");
                        System.out.println("The Source :" + packet.getHeader(udp).source());
                        System.out.println("The Destination :" + packet.getHeader(udp).destination());
                    }

                    if (packet.getHeader(udp).destination() == 53) {
                        System.out.println("This packet is a Request");
                        System.out.println("The Source :" + packet.getHeader(udp).source());
                        System.out.println("The Destination :" + packet.getHeader(udp).destination());
                    }

                  
                    System.out.println("The Request :" + packet.getHeader(udp).checksum());
                    System.out.println("The Size of packet :" + packet.getTotalSize());

Find back the String (human readable form) of the payload

Hi! I'm new with jnetpcap and I'm trying to implement a security protocol that should make custom packets with string messages as data. And now receiving packets I need to retrieve plain messages not the Hexdump string. Typically in this figure, I want to get the "2;7;12|..." part of the text.

0000: 32 3b 37 3b 31 32 3b 7c 42 6f 6e 6a 6f 75 72 4a 2;7;12;|BonjourJ
0010: 65 20 76 6f 75 73 20 61 69 6d 65 e vous aime

Anyone can help me?

JFlow and JFlowmap

Hi
how I can get packets from JFlow or JFlowMap ?
Innocent

JFlow JFlowMap

Hi
how I can get packets from JFlow or JFlowMap
Innocent

JFlow and JFlowmap

hello Smile
jnetpcap group packets into flows using JFlow and Jflowap so I want to get all packets in one flow.then extract the features from these packets for my use.
I execute this example http://jnetpcap.com/node/144 and I get output like this.

total packet count=483
total flow count=21
flow[0] 10.1.1.101:3187 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[7/6/13],
flow[1] 10.1.1.101:3199 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[9/11/20],
flow[2] 209.225.11.237 -> 10.1.1.101:6 Ip4 tot pkts=[1],
flow[3] 10.1.1.101:3200 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[74/135/209],
flow[4] 209.225.0.6 -> 10.1.1.101:6 Ip4 tot pkts=[18],
flow[5] 10.1.1.101:3193 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[9/6/15],
flow[6] 10.1.1.101:3192 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[8/6/14],
flow[7] 10.1.1.101:3177 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[5/5/10],
flow[8] 10.1.1.101:3188 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[7/7/14],
flow[9] 10.1.1.101:3191 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[8/6/14],
flow[10] 10.1.1.101:3198 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[9/10/19],
flow[11] 10.1.1.101:3195 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[5/5/10],
flow[12] 10.1.1.101:3189 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[8/9/17],
flow[13] 10.1.1.101:3184 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[7/6/13],
flow[14] 10.1.1.101:3197 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[6/6/12],
flow[15] 10.1.1.101:3183 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[7/6/13],
flow[16] 10.1.1.101:3190 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[9/10/19],
flow[17] 10.1.1.101:3179 -> 209.225.11.237:80 Tcp fw/rev/tot pkts=[7/6/13],
flow[18] 10.1.1.101:3185 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[7/6/13],
flow[19] 10.1.1.101:3196 -> 10.1.1.1:80 Tcp fw/rev/tot pkts=[6/6/12],
flow[20] 10.1.1.101:3194 -> 209.225.0.6:80 Tcp fw/rev/tot pkts=[8/6/14],

I want to handle each flow alone.

Thanks in advance.

src_port and dest_Port

hello everyone
can you help me how I can extract dest Port from a packet, but I want it int value for example port http 80 so I want get 80 values
thanks

UDP Checksum is calculated wrong (JNetPCAP-1.4.r1425-1)

Hi,

I am using JNetPCAP as a traffic generator. I am creating a certain amount of different udp packets and are sending them later onto my firewall. However during the creation of the packets the checksum is either correct or omitted but it should always be correct. I do not know where the error lies. I am posting my method that I use for generating below. The source ip range is from 1.1.1.1 - 9.9.9.9

I use JNETPcap under Linux here is the relevant data:

Distribution: Ubuntu Server 15.04 vivid
uname result: Linux sender 3.19.0-25-generic #26-Ubuntu SMP Fri Jul 24 21:17:31 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
libpcap version: libpcap_1.6.2-2 (got via apt-get libpcap-dev)

public synchronized static JPacket createNormalUDPPacket(int frameLength, byte[] sourceMac, byte[] destinationMac,byte[] sourceAddress, byte[] destinationAddress, int sourcePort, int destinationPort) {

// Header length for UDP is 42
int dataLength = frameLength - 42;
JPacket packet = new JMemoryPacket(frameLength);
packet.order(ByteOrder.BIG_ENDIAN);
packet.setUShort(12, 0x0800);
packet.scan(JProtocol.ETHERNET_ID);
Ethernet ethernet = packet.getHeader(new Ethernet());
ethernet.source(sourceMac);
ethernet.destination(destinationMac);
ethernet.checksum(ethernet.calculateChecksum());


// IP v4 packet
packet.setUByte(14, 0x40 | 0x05);
packet.scan(JProtocol.ETHERNET_ID);
Ip4 ip4 = packet.getHeader(new Ip4());
ip4.type(Ip4.Ip4Type.UDP);
ip4.length(frameLength - ethernet.size());
ip4.source(sourceAddress);
ip4.destination(destinationAddress);
ip4.ttl(32);
ip4.flags(0);
ip4.offset(0);
ip4.checksum(ip4.calculateChecksum());


// UDP packet
packet.scan(JProtocol.ETHERNET_ID);

Udp udp = packet.getHeader(new Udp());
udp.setUShort(0, sourcePort);
udp.setUShort(2, destinationPort);
udp.setUShort(4, frameLength - ethernet.size() - ip4.size());
udp.setUShort(6, udp.calculateChecksum());
packet.setByteArray(42, new byte[dataLength]);
packet.scan(Ethernet.ID);

return packet;
}