I need to:
If I do a manual reverse lookup on a company using this tool and the domain name, I'm given the IP address:
Here's what I have in Python so far:
import socket
request_ip = xxx.xxx.101.75 # Full IP address actually used
def reverse_dns(request_ip):
if socket.inet_aton(request_ip):
try:
r_dns = socket.gethostbyaddr(request_ip)
except:
logging.error('######## Host IP reverse DNS lookup failed. ########')
else:
logging.error('######## Host IP is not a valid IP address. ########')
return r_dns
reverse_dns = reverse_dns(request_ip)
Problem:
('xxx-xxx-101-75.somedata.com', [], ['xxx.xxx.101.75'])
If DNS will give you an IP address for the name knowledge.com, but won't give you the name knowledge.con for that same IP address, then there's no way to get it from DNS.
A likely reason is that reverse lookup is just not configured. The existence of an A record (name-to-addr) does not require a corresponding PTR record (addr-to-name).
That's just the way it is.