How is encoded the URL

Hi,
I read here that the request is base64URL encode. But if I make a pyhton script, or use a web site to encode “example.com” I get a tottaly different result :
Mine:

ZXhhbXBsZS5jb20

Expected:

q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB

What I’m missing?
Thanks for the help

It is not just the example.com that is base64 encoded, it is the entire DNS message.

This includes the DNS message header, as well as the question section which contains example.com.

Taking the example of q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB:

>>> import dns.message
>>> packet = 'q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB'.decode('base64')
>>> msg = dns.message.from_wire(packet)
>>> print msg
id 43981
opcode QUERY
rcode NOERROR
flags RD
;QUESTION
www.example.com. IN A
;ANSWER
;AUTHORITY
;ADDITIONAL

I understand now what contains the base64, but is there a way to generate automatically a request? Or should I copy/paste and encode all the fields (from a wireshark request).?

You do realize that it is also possible to get a JSON response and make the query with a simple GET URL, right? https://developers.cloudflare.com/1.1.1.1/dns-over-https/json-format/

Yeah, I already made a script in Python testing if DoH is running on the server by using Json, but I wanted to try with Wireformat too

This topic was automatically closed after 14 days. New replies are no longer allowed.