/usr/share/doc/python-getdns-doc/examples/query-stubmode.py is in python-getdns-doc 0.6.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/env python
import getdns, sys
hostname = sys.argv[1]
ctx = getdns.Context()
ctx.resolution_type = getdns.RESOLUTION_STUB
extensions = { "return_both_v4_and_v6" : getdns.EXTENSION_TRUE }
ctx.resolution_type = getdns.RESOLUTION_STUB
try:
results = ctx.address(name=hostname, extensions=extensions)
except getdns.error as e:
print(str(e))
sys.exit(1)
if results.status == getdns.RESPSTATUS_GOOD:
for addr in results.just_address_answers:
print(addr["address_data"])
else:
print("getdns.address() returned an error: {0}".format(results["status"]))
|