equal
deleted
inserted
replaced
6 from whois import NICClient |
6 from whois import NICClient |
7 |
7 |
8 |
8 |
9 def whois(url): |
9 def whois(url): |
10 # clean domain to expose netloc |
10 # clean domain to expose netloc |
11 domain = extract_domain(url) |
11 ip_match = re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", url) |
|
12 if ip_match: |
|
13 domain = url |
|
14 else: |
|
15 domain = extract_domain(url) |
12 try: |
16 try: |
13 # try native whois command first |
17 # try native whois command first |
14 r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE) |
18 r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE) |
15 text = r.stdout.read() |
19 text = r.stdout.read() |
16 except OSError: |
20 except OSError: |