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

IP address, Request Response for UDP Packet

1 reply [Last post]
Jishan
Offline
Joined: 05/20/2016

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());

leonakatokwa1
Offline
Joined: 05/26/2016
Hopefully someone can help

Hopefully someone can help you with this. I cant see anything wrong. - Gary McClure

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.