Properly display details when the URL contains an IP instead of a domain.

Fix #3
travis
Raphaël Vinot 2015-07-13 12:46:07 +02:00
parent c8323bb72d
commit 6a93526543
1 changed files with 14 additions and 1 deletions

View File

@ -242,7 +242,20 @@ def dns_resolve(url):
host = fex.get_host().lower()
ipv4 = None
ipv6 = None
if not is_ip(host):
if is_ip(host):
if ':' in host:
try:
socket.inet_pton(socket.AF_INET6, host)
ipv6 = [host]
except:
pass
else:
try:
socket.inet_aton(host)
ipv4 = [host]
except:
pass
else:
try:
ipv4 = [str(ip) for ip in dns.resolver.query(host, 'A')]
except: