paulc / dnslib

A Python library to encode/decode DNS wire-format packets
https://github.com/paulc/dnslib
BSD 2-Clause "Simplified" License
295 stars 84 forks source link

Avoiding misconceptions with hexdump #52

Closed SkySai1 closed 11 months ago

SkySai1 commented 1 year ago

Hello, can you please add into README a note that RDATA format like this "\# 15 0761617263683634067562756E7475" is byte's hexdump format, and way to bring it back is unhex it via: binascii.unhexlify(data)?

robinlandstrom commented 1 year ago

It is the standard way to format RDATA for unknown RR types according to https://www.rfc-editor.org/rfc/rfc3597

   The RDATA section of an RR of unknown type is represented as a
   sequence of white space separated words as follows:

      The special token \# (a backslash immediately followed by a hash
      sign), which identifies the RDATA as having the generic encoding
      defined herein rather than a traditional type-specific encoding.

      An unsigned decimal integer specifying the RDATA length in octets.

      Zero or more words of hexadecimal data encoding the actual RDATA
      field, each containing an even number of hexadecimal digits.