code-dumps/py/dns-lookup-dnspython.py

16 lines
357 B
Python
Raw Normal View History

2024-10-24 23:09:21 +08:00
#!/usr/bin/python3
import dns.resolver
import dns.query
res = dns.resolver.Resolver()
res.timeout = 10
res.lifetime = 25
res.nameservers = ['192.168.86.50']
#results = res.query('blog.headdesk.me', 'A', tcp=True)
results = res.resolve('blog.headdesk.me', 'A', tcp=True)
print('Result:')
for line in results:
print(line.to_text())