-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathip_checker.py
50 lines (41 loc) · 938 Bytes
/
ip_checker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import rich
import requests
import config
def check_ip(ip):
response = requests.get(
url = f"https://ipwhois.app/json/{ip}",
headers = config.HEADERS
)
if response.status_code == 200:
result = response.json()
rich.print(
f"""
[ IP RESULTS ]
[green]-> Found some info[/green]
| DETAILS
|
| IP
| [green]->[/green] {result.get("ip")}
|
| Country
| [green]->[/green] {result.get("country")}
|
| Region
| [green]->[/green] {result.get("region")}
|
| City
| [green]->[/green] {result.get("city")}
|
| Location
| [green]->[/green] {result.get("latitude")}, {result.get("longitude")}
|
| Internet Service Provider (ISP)
| [green]->[/green] {result.get("isp")}
|
| Organization
| [green]->[/green] {result.get("org")}
[ --- ]
"""
)
else:
rich.print("[yellow]-> Couldn't find any information![/yellow]")