I want to retrieve raw bytes of DNS response for debugging reason, for example:
dig -t https clickhouse.com
;; ANSWER SECTION:
clickhouse.com. 242 IN HTTPS 1 . alpn="h3,h3-29,h2" ipv4hint=172.66.40.249,172.66.43.7 ipv6hint=2606:4700:3108::ac42:28f9,2606:4700:3108::ac42:2b07
How can I get the bytes of those answer section, is there some existing tool that can show me those raw bytes before decoded into plain text?
I tried with wireshark but it's encrypted, tried with another dns server but I don't get any response (seems blocked by ISP).
**UPDATE**:
so I do manual way, create a simple program in Go:
m := &dns.Msg{
MsgHdr: dns.MsgHdr{
Authoritative: false,
AuthenticatedData: false,
CheckingDisabled: true,
RecursionDesired: true,
Opcode: dns.OpcodeQuery,
},
Question: make([]dns.Question, 1),
}
q := &m.Question
q.Qclass = dns.ClassINET
q.Qtype = dns.TypeHTTPS
q.Name = "clickhouse.com."
// 0 = {uint8} 0
r, err := dns.Exchange(m, "9.9.9.9:9953")
put breakpoint on dns.Answer, off, err = unpackRRslice(int(dh.Ancount), msg, off)
on github.com/miekg/dns/msg.go:840
then copy paste the msg
to text file.
Asked by Kokizzu
(10481 rep)
Mar 8, 2023, 12:46 PM
Last activity: Mar 9, 2023, 10:04 PM
Last activity: Mar 9, 2023, 10:04 PM