import requests
def get_ip_info(ip):
api_url = f"https://astroboyapi.com/api/ip.php?ip={ip}"
try:
response = requests.get(api_url)
if response.status_code == 200:
data = response.json()
return data
else:
print(f"Request failed with status code: {response.status_code}")
return None
except requests.exceptions.RequestException as e:
print(f"Request error: {e}")
return None
def check_IP_info(ip):
ip_info = get_ip_info(ip)
if ip_info:
print(f"Info for IP {ip}:")
print(f"ASN: {ip_info['asn']}")
print(f"City: {ip_info['city']}")
print(f"Country: {ip_info['country']}")
print(f"ISP: {ip_info['isp']}")
print(f"Region: {ip_info['region']}")
print(f"Risk: {ip_info['risk']}")
print(f"Risk Score: {ip_info['score']}")
if __name__ == "__main__":
ip = input("Enter IP: ")
check_ip_info(ip)