PCAP DNS request not give any response.

May 29, 2013 at 6:55 AM
I have create a DNS request using C# and PCAP. I checked the request using the wireshark. but there are not response.

I have compared DNS request which have a response. The flags and DNS query values are same.

I cant figure out why the dns resolver is not sending the response. Please help me.

Thank you.

My packet generating method:
private Packet getPacket(string s, string d,string domain)
{
    Random r = new Random();
    EthernetLayer ethernetLayer =
    new EthernetLayer
   {
  Source = new MacAddress("00:0C:29:E5:FA:36"),
  Destination = new MacAddress("00:0c:29:e5:fa:36"),
  EtherType = EthernetType.None, // Will be filled automatically.

   };


    IpV4Layer ipV4Layer =
        new IpV4Layer
        {
            Source = new IpV4Address(s),
            CurrentDestination = new IpV4Address(d),
            Fragmentation = IpV4Fragmentation.None,
            HeaderChecksum = null, // Will be filled automatically.
            Identification = 123,
            Options = IpV4Options.None,
            Protocol = null, // Will be filled automatically.
            Ttl = 100,
            TypeOfService = 0,

        };

    UdpLayer udpLayer =
        new UdpLayer
        {
           SourcePort =ushort.MaxValue,
            DestinationPort = 53,
            Checksum = null, // Will be filled automatically.
            CalculateChecksumValue = true,

        };

    DnsLayer dnsLayer =
        new DnsLayer
        {
            Id = ushort.Parse(r.Next(0,99999).ToString()),
            IsResponse = false,
            OpCode = DnsOpCode.Query,
            IsAuthoritativeAnswer = false,
            IsTruncated = false,
            IsRecursionDesired = true,
            IsRecursionAvailable = false,
            FutureUse = false,
            IsAuthenticData = false,
            IsCheckingDisabled = false,
            ResponseCode = DnsResponseCode.NoError,
            Queries = new[]
                              {
                                  new DnsQueryResourceRecord(new DnsDomainName("col.stc.s-msn.com"),
                                                             DnsType.A,
                                                             DnsClass.Internet),
                              },
            Answers = null,
            Authorities = null,
            Additionals = null,
            DomainNameCompressionMode = DnsDomainNameCompressionMode.All,
        };

    PacketBuilder builder = new PacketBuilder(ethernetLayer, ipV4Layer, udpLayer, dnsLayer);

    return builder.Build(DateTime.Now);
 } }
This is my packet sending function:
private static void performRequest(LivePacketDevice device)
{
    using (PacketCommunicator communicator = device.Open(100,PacketDeviceOpenAttributes.Promiscuous,1000))
    {
        for (int i = 0; i < threadCount; i++)
        {
            Thread requester= new Thread(() =>
            {
                try
                {
                    Program p = new Program();
                    Random r = new Random();
                    string resolve = resolvers[r.Next(0, resolvers.Count-1)].ToString();

                    communicator.SendPacket(p.getPacket(destinationIP.ToString(), resolve, domainName));

                    p = null;
                    r = null;
                }
                catch (Exception ex) { Console.WriteLine(ex.Message); }
            });
            requester.Start();

            Thread.Sleep(1000);
        }

    }
}
Coordinator
May 31, 2013 at 8:36 AM
Can you give me a .pcap file with your DNS request and a .pcap file with the compared DNS request?