Domain Name System

Here is a DNS message. Answer the following questions about it:

  1. What is the ID number of the transaction?
  2. Is this is request or a response?
  3. Is recursion available or not?
  4. What is the type of the request?
  5. What is the name of the host that was requested?
  6. What is the IP Address of the host?
  7. Is the response authoritative?
  8. What is the value of the TTL field?

Hint, you will definitely want to google and find the RFC or some other detailed source that describes the format of the request/response in detail. You might also capture a DNS message in Wireshark, and use that as an example.

44 02 81 80 
00 01 00 01 
00 00 00 00 
0c 72 61 6d 
62 6c 69 6e 
77 72 65 63 
6b 03 63 6f 
6d 00 00 01 
00 01 c0 0c 
00 01 00 01 
00 00 06 2b 
00 04 40 1e 
e4 14

Bit Twiddling in Python


In [3]:
dec = int('0x10',16)
dec


Out[3]:
16

In [16]:
# logical and and or
print(bin(16),bin(1),bin(16|1))
print(bin(16),bin(1),bin(16&1))

# Note that bin removes the leading zeros.


0b10000 0b1 0b10001
0b10000 0b1 0b0

In [15]:
# Converting to characters -- Also you can google a hex ascii table
chr(int('0x73',16))


Out[15]:
's'