THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

How does a web browser parse the raw bytes of each part of a DNS name to a human readable form?

My focus is to parse the structure of a DNS packet programmatically using python. Consider the snap where my browser send a large domain name through the pipe without even complaining.

image description

Let's take a close look at the byte string: b'\x03www99dksjfhkdfgh534534534dkfghkldfhglksdfhg435634634dkfghlkd\x03com\x00'

image description

I can programmatically write my codes in python with a logic like this image description

So my question is: How does a web browser parse the raw bytes of each part of a DNS name to a human readable form? Any form of advice/help is welcomed.

Junior's avatar
1
Junior
asked 2020-06-27 15:34:54 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

(Looks like the red text is for a different query - "www" vs "www2" in the screen shot)
When all else fails, read the instructions: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION

3.1. Name space definitions

Domain names in messages are expressed in terms of a sequence of labels.
Each label is represented as a one octet length field followed by that
number of octets.  Since every domain name ends with the null label of
the root, a domain name is terminated by a length byte of zero.  The
high order two bits of every length octet must be zero, and the
remaining six bits of the length field limit the label to 63 octets or
less.

Wireshark displays [Label Count: 3] for www2, <the long text>, com

The red text should start with \x04www2 to match the screen shot.

Chuckc's avatar
3k
Chuckc
answered 2020-06-27 17:25:39 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer