hns_doh_loadbalancer/create_wireform.py

16 lines
309 B
Python
Raw Permalink Normal View History

2024-10-09 20:21:07 +11:00
import base64
import dns.message
# Generate custom request
domain = "woodburn"
message = dns.message.make_query(domain, dns.rdatatype.A,id=0)
wireBytes = message.to_wire()
wire = base64.b64encode(wireBytes)
print(wire.decode("utf-8"))
# Read
message = dns.message.from_wire(wireBytes)
print(str(message))