equal
deleted
inserted
replaced
17 def whois(url, command=False): |
17 def whois(url, command=False): |
18 # clean domain to expose netloc |
18 # clean domain to expose netloc |
19 ip_match = re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", url) |
19 ip_match = re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", url) |
20 if ip_match: |
20 if ip_match: |
21 domain = url |
21 domain = url |
|
22 try: |
|
23 result = socket.gethostbyaddr(url) |
|
24 except socket.herror as e: |
|
25 pass |
|
26 else: |
|
27 domain = result[0] |
22 else: |
28 else: |
23 domain = extract_domain(url) |
29 domain = extract_domain(url) |
24 if command: |
30 if command: |
25 # try native whois command |
31 # try native whois command |
26 r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE) |
32 r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE) |