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

DNAME records are broken #50

Closed nss-csis closed 6 months ago

nss-csis commented 1 year ago

DNAME records are broken as this example shows: example_2_done

To compare here is the result from dig: example_1_done

I think it is a matter of DNAME missing from RDMAP. Should I open a PR to fix it?

SkySai1 commented 1 year ago

In parse method of dnslib there is limited rtype for parsing, the others is hexing via binascii.hexlify(data) and bring back in HEXDUMP format. To fix it you need to unhex gated data with binascii.unhexlify(data)

P.S. \# - specify HEXDUMP format 18 - length of origin data in bytes 0A636<...>756B00 - the hexdump

paulc commented 6 months ago

At the moment we don't decode the DNAME rdata (which is why you get the generic hexdump output). The logic for DNAME substitution is pretty complex (see https://www.rfc-editor.org/rfc/rfc6672.html) - if anyone wants to volunteer a PR I'd be happy to merge this.