I am trying to query reverse lookups in dnspython. Unfortunately, the from_address() function does not let me hand over a IP by variable. Any ideas why?
#!/usr/bin/env python
import dns.resolver,dns.reversename
with open("test", "r") as ips:
for ip in ips:
ip = str(ip)
n = dns.reversename.from_address(ip)
print str(dns.resolver.query(n,"PTR")[0])
I am new to python; would be great if somebody could help out!