Output IPv6 addresses
This commit is contained in:
parent
c93cd3623a
commit
c95ba17678
|
@ -7,6 +7,8 @@ import dns.resolver
|
||||||
|
|
||||||
exp = re.compile('([^\.]+)')
|
exp = re.compile('([^\.]+)')
|
||||||
|
|
||||||
|
hosts = []
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,9 +23,14 @@ if __name__ == '__main__':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = dns.resolver.query(host)
|
if True:
|
||||||
ip = socket.gethostbyname(str(res.qname))
|
res = dns.resolver.query(host)
|
||||||
|
ips = socket.getaddrinfo(str(res.qname), None)
|
||||||
|
|
||||||
print("{0}\t{1} {2}".format(ip, str(res.qname)[:-1], exp.match(host).group(0)))
|
for ip in ips:
|
||||||
|
entry = (ip[4][0], str(res.qname)[:-1], exp.match(host).group(0))
|
||||||
|
if not entry in hosts:
|
||||||
|
print("{0:45} {1} {2}".format(ip[4][0], str(res.qname)[:-1], exp.match(host).group(0)))
|
||||||
|
hosts.append(entry)
|
||||||
except:
|
except:
|
||||||
sys.stderr.write('Failed to get IP for: {0}\n'.format(host))
|
sys.stderr.write('Failed to get IP for: {0}\n'.format(host))
|
||||||
|
|
Loading…
Reference in New Issue