Retrieve whois data for the given IP.
(ip)
| 79 | return None |
| 80 | |
| 81 | def get_whois_info(ip): |
| 82 | """Retrieve whois data for the given IP.""" |
| 83 | try: |
| 84 | response = requests.get(f"http://ip-api.com/json/{ip}") |
| 85 | data = response.json() |
| 86 | |
| 87 | # Get the hostname using the socket library |
| 88 | hostname = get_hostname(ip) |
| 89 | if hostname: |
| 90 | print(f"[+] Hostname: {hostname}") |
| 91 | |
| 92 | return data |
| 93 | except Exception as e: |
| 94 | print(f"[!] Error fetching whois data: {e}") |
| 95 | return None |
| 96 | |
| 97 | |
| 98 | def display_whois_info(data): |
no test coverage detected