in reply to How to print Compressed data in DNS

You're getting wishy-washy answers because you've asked a wishy-washy question.

Can some one tell how to print a DNS packet answer

First of all, by what means are you capturing the DNS packet? Or put differently, what are you starting with?

the answer part it has the domain name compressed

The answer to most requests ("A") is an IPv4 address, not a domain name. It's not compressed. It's stored as a 32-bit int in network byte order.

When doing a reverse lookup ("PTR"), you get a domain name. It's not stored as a single string, but it's not compressed either. It's stored as a number of NUL-terminated strings, one for each segment of the full domain name, plus an empty one.

RFC 1035: Domain Names - Implementation and Specification

  • Comment on Re: How to print Compressed data in DNS

Replies are listed 'Best First'.
Re^2: How to print Compressed data in DNS
by deewanagan (Novice) on Nov 28, 2008 at 20:36 UTC
    tanx everbody, i make the situation clear, I made a DNS packet and then sent it to the server, i got an answer, parsed the Header part then parsed the Question part now i want to parse the Answer part, in the answer part has the format "NAME,TYPE,CLASS,TTL,RDLENGHT,RDATA", if this NAME is compressed how can i print it without decompressing it, and how can i decompress it and print it? Thanx