-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipinfo.py
More file actions
128 lines (118 loc) · 5.48 KB
/
ipinfo.py
File metadata and controls
128 lines (118 loc) · 5.48 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#this tool make by
#python program ip address info
import os
import requests
import time
y = "\033[33m"
red = "\033[31m"
rs = "\033[0m"
g = "\033[32m"
k = """
██╗███╗ ██╗███████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗
██║████╗ ██║██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚██╗ ██╔╝
██║██╔██╗ ██║█████╗ ██║ ██║██████╔╝██║ ██║ ╚████╔╝
██║██║╚██╗██║██╔══╝ ██║ ██║██╔══██╗██║ ██║ ╚██╔╝
██║██║ ╚████║██║ ╚██████╔╝██████╔╝╚██████╔╝ ██║
╚═╝╚═╝ ╚═══╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝
ip address info
api use this "http://ip-api.com/json/"
"""
print(red+k+rs)
url = 'http://ip-api.com/json/'
m = input(f'{y}Enter ip address and if your ip address pass enter :-{rs}')
y = '?fields=status,status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,currency,isp,org,as,asname,reverse,mobile,proxy,hosting,query'
def data(m):
response = requests.get(url+m+y)
data = response.json()
return data
data = data(m)
hi = {data['query']}
print(" ")
print(f"{g}ip: {data['query']}{rs}")
if 'status' in data:
print(f"{g}status: {data['status']}{rs}")
else:
print(f"{red}Status information not available{rs}")
print(f"{g}continent: {data['continent']}{rs}")
print(f"{g}continentCode: {data['continentCode']}{rs}")
print(f"{g}region: {data['region']}{rs}")
print(f"{g}regionName: {data['regionName']}{rs}")
print(f"{g}city: {data['city']}{rs}")
print(f"{g}district: {data['district']}{rs}")
print(f"{g}zip: {data['zip']}{rs}")
print(f"{g}lat: {data['lat']}{rs}")
print(f"{g}lon: {data['lon']}{rs}")
print(f"{g}timezone: {data['timezone']}{rs}")
print(f"{g}offset: {data['offset']}{rs}")
print(f"{g}currency: {data['currency']}{rs}")
print(f"{g}isp: {data['isp']}{rs}")
print(f"{g}org: {data['org']}{rs}")
print(f"{g}as: {data['as']}{rs}")
print(f"{g}asname: {data['asname']}{rs}")
if 'mobile' in data:
print(f"{g}mobile: {data['mobile']}{rs}")
else:
print(f"{red}moblie information not available{rs}")
if 'proxy' in data:
print(f"{g}proxy: {data['proxy']}{rs}")
else:
print(f"{red}proxy information not available{rs}")
print(f"{g}hosting: {data['hosting']}{rs}")
if 'dns' in data:
print(f"{g}dns: {data['dns']}{rs}")
else:
print(f"{red}moblie information not available{rs}")
if 'geo' in data:
print(f"{g}geo: {data['geo']}{rs}")
else:
print(f"{red}moblie information not available{rs}")
if 'ip' in data:
print(f"{g}gns ip: {data['ip']}{rs}")
else:
print(f"{red}dnsip information not available{rs}")
print(" ")
with open(f'{hi}', "a") as file:
file.write(f"{k}\n")
file.write(f"ip: {data['query']}\n")
if 'status' in data:
file.write(f"status: {data['status']}\n")
else:
file.write("status information not available\n")
file.write(f"continent: {data['continent']}\n")
file.write(f"region: {data['region']}\n")
file.write(f"regionName: {data['regionName']}\n")
file.write(f"city: {data['city']}\n")
file.write(f"district: {data['district']}\n")
file.write(f"zip: {data['zip']}\n")
file.write(f"lat: {data['lat']}\n")
file.write(f"lon: {data['lon']}\n")
file.write(f"timezone: {data['timezone']}\n")
file.write(f"offset: {data['offset']}\n")
file.write(f"currency: {data['currency']}\n")
file.write(f"isp: {data['isp']}\n")
file.write(f"org: {data['org']}\n")
file.write(f"as: {data['as']}\n")
file.write(f"asname: {data['asname']}\n")
#
if 'mobile' in data:
file.write(f"mobile: {data['mobile']}\n")
else:
file.write("moblie information not available\n")
file.write(f"hosting: {data['hosting']}\n")
#
if 'dns' in data:
file.write(f"dns: {data['dns']}\n")
else:
file.write("dns information not available\n")
#
if 'geo' in data:
file.write(f"geo: {data['geo']}\n")
else:
file.write("geo information not available\n")
#
if 'ip' in data:
file.write(f"dnsip: {data['ip']}\n")
else:
file.write("dnsip information not available\n")
file.write(f"time \n")
file.write(f"********************************\n")