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

16 lines
357 B
Python
Raw Normal View History

2023-04-21 13:01:56 +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())