-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
350 lines (302 loc) · 9.83 KB
/
main.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
import ipinfo
import pprint
from colorama import init, Fore, Style
import requests
import os
import webbrowser
# Inicializar colorama
init()
# Functions
def hueco():
print()
print("--------------------")
print()
def espacio():
for a in range(24):
print(Fore.GREEN + "-" + Style.RESET_ALL, end="", flush=True)
print(Fore.RED + "-" + Style.RESET_ALL, end="", flush=True)
print(Fore.BLUE + "-" + Style.RESET_ALL, end="", flush=True)
print(Fore.YELLOW + "-" + Style.RESET_ALL, end="", flush=True)
print(Fore.MAGENTA + "-" + Style.RESET_ALL, end="", flush=True)
def obtener_direccion_ip():
try:
response = requests.get('https://ipapi.co/json')
data = response.json()
ip = data['ip']
return ip
except:
return False
def verificar_vpn(ip):
api_key = "f0b7f18a3e7541149ae064d21b443589"
url = f"https://vpnapi.io/api/{ip}?key={api_key}"
try:
response = requests.get(url)
data = response.json()
vpn_status = data['security']['vpn']
return vpn_status
except:
return False # No se está utilizando una VPN
def verificar_proxy(ip):
api_key = "f0b7f18a3e7541149ae064d21b443589"
url = f"https://vpnapi.io/api/{ip}?key={api_key}"
try:
response = requests.get(url)
data = response.json()
proxy_status = data['security']['proxy']
return proxy_status
except:
return False # No se está utilizando un proxy
def verificar_tor(ip):
api_key = "f0b7f18a3e7541149ae064d21b443589"
url = f"https://vpnapi.io/api/{ip}?key={api_key}"
try:
response = requests.get(url)
data = response.json()
tor_status = data['security']['tor']
return tor_status
except:
return False # No se está utilizando un tor node
def verificar_relay(ip):
api_key = "f0b7f18a3e7541149ae064d21b443589"
url = f"https://vpnapi.io/api/{ip}?key={api_key}"
try:
response = requests.get(url)
data = response.json()
relay_status = data['security']['relay']
return relay_status
except:
return False # No se está utilizando un relay de apple
def create_log():
folder_name = "logs"
if not os.path.exists(folder_name):
os.mkdir(folder_name)
access_token = '13e422b8b69e59'
handler = ipinfo.getHandler(access_token)
print(f'{Fore.MAGENTA}Welcome to IP info by otema {Fore.LIGHTBLACK_EX}(type "mine" to select your current ip){Fore.RESET}')
print(f'{Fore.LIGHTWHITE_EX}IP: {Fore.RESET}', end="")
IP = str(input()).lower()
if IP == "all":
print(f'{Fore.LIGHTBLACK_EX}-- All info unlocked!{Fore.RESET}')
all_info = True
IP = str(input("IP: "))
else:
all_info = False
if IP == "mine":
IP = obtener_direccion_ip()
if IP == False:
print(f'{Fore.RED}[!]{Fore.RESET} Error al obtener tu dirección IP, comprueba tu conexión a internet e inténtalo de nuevo')
exit()
else:
pass
details = handler.getDetails(IP)
# Vars
VPN = verificar_vpn(IP)
proxy = verificar_proxy(IP)
tor = verificar_tor(IP)
relay = verificar_relay(IP)
try:
ALL = details.all
except:
ALL = "all info couldn't be collected"
try:
hostname = details.hostname
except:
hostname = "No encontrado"
try:
city = details.city
except:
city = "No encontrada"
try:
region = details.region
except:
region = "No encontrada"
try:
country = details.country
except:
country = "No encontrada"
try:
loc = details.loc
except:
loc = "No encontrada"
try:
org = details.org
except:
org = "No encontrada"
try:
postal = details.postal
except:
postal = "No encontrado"
try:
timezone = details.timezone
except:
timezone = "No encontrada"
if loc != "No encontrada":
url_maps = f'https://google.com/maps/place/{loc}'
else:
url_maps = "No disponible"
url_IP = f'https://whatismyipaddress.com/ip/{IP}'
# List
all = []
all.append(hostname)
all.append(city)
all.append(region)
all.append(country)
all.append(loc)
all.append(org)
all.append(postal)
all.append(timezone)
# OUTPUT
os.system('cls' if os.name == 'nt' else 'clear')
espacio()
print(f' {Fore.LIGHTWHITE_EX}Información de {Fore.RED}{IP}{Fore.LIGHTWHITE_EX}.{Fore.RESET}')
espacio()
print(" ")
print()
print(f'{Fore.CYAN}Información básica:')
print()
print(f'{Fore.YELLOW}Hostname: {Fore.GREEN}{hostname}')
print(f'{Fore.YELLOW}Organización: {Fore.GREEN}{org}')
print()
print(f'{Fore.CYAN}Seguridad:')
print()
if VPN:
print(f'{Fore.YELLOW}VPN: {Fore.GREEN}{VPN}')
else:
print(f'{Fore.YELLOW}VPN: {Fore.RED}{VPN}')
if proxy:
print(f'{Fore.YELLOW}Proxy: {Fore.GREEN}{proxy}')
else:
print(f'{Fore.YELLOW}Proxy: {Fore.RED}{proxy}')
if tor:
print(f'{Fore.YELLOW}Tor: {Fore.GREEN}{tor}')
else:
print(f'{Fore.YELLOW}Tor: {Fore.RED}{tor}')
if relay:
print(f'{Fore.YELLOW}Relay: {Fore.GREEN}{relay}')
else:
print(f'{Fore.YELLOW}Relay: {Fore.RED}{relay}')
print()
print(f'{Fore.CYAN}Geolocalización:')
print()
print(f'{Fore.YELLOW}País: {Fore.GREEN}{country}{Fore.RESET}')
print(f'{Fore.YELLOW}Región: {Fore.GREEN}{region}{Fore.RESET}')
print(f'{Fore.YELLOW}Ciudad: {Fore.GREEN}{city}{Fore.RESET}')
print(f'{Fore.YELLOW}CP: {Fore.GREEN}{postal}{Fore.RESET}')
print(f'{Fore.YELLOW}Zona Horaria: {Fore.GREEN}{timezone}{Fore.RESET}')
print(f'{Fore.YELLOW}Google Maps: {Fore.BLUE}{url_maps}{Fore.RESET}')
print()
print(f'{Fore.CYAN}Otros servicios:')
print()
print(f'{Fore.YELLOW}Enlace a whatismyipaddress: {Fore.BLUE}{url_IP}{Fore.RESET}')
if all_info:
print()
print(f'{Fore.CYAN}All info:{Fore.LIGHTBLACK_EX}')
print()
pprint.pprint(details.all)
print()
espacio()
print()
while True:
create_log()
html_content = f"""
<!DOCTYPE html>
<html>
<head>
<title>IP Information</title>
<style>
body {{
font-family: Arial, sans-serif;
background-color: #222;
color: #ddd;
margin: 0;
padding: 0;
}}
.container {{
display: flex;
justify-content: center;
margin: 90px;
}}
.info {{
width: 40%;
}}
h1 {{
color: #ffc107;
text-align: center;
}}
h2 {{
color: #f44336;
border-bottom: 1px solid #ddd;
padding-bottom: 5px;
margin-top: 20px;
}}
p {{
margin: 5px 0;
}}
.link {{
color: #2196f3;
text-decoration: underline;
cursor: pointer;
}}
</style>
</head>
<body>
<div class="container">
<div class="info">
<h1>IP Information for <span style="color: green"> {IP} </span></h1>
<h2>Basic Information:</h2>
<p>Hostname: {hostname}</p>
<p>Organization: {org}</p>
<!-- Include other basic information here -->
<h2>Security Information:</h2>
<p>VPN: <span style="color: {'green' if VPN else 'red'}">{'Yes' if VPN else 'No'}</span></p>
<p>Proxy: <span style="color: {'green' if proxy else 'red'}">{'Yes' if proxy else 'No'}</span></p>
<p>Tor: <span style="color: {'green' if tor else 'red'}">{'Yes' if tor else 'No'}</span></p>
<p>Relay: <span style="color: {'green' if relay else 'red'}">{'Yes' if relay else 'No'}</span></p>
<!-- Include other security information here -->
<h2>Geolocation Information:</h2>
<p>Country: {country}</p>
<p>Region: {region}</p>
<p>City: {city}</p>
<p>Postal Code: {postal}</p>
<p>Timezone: {timezone}</p>
<!-- Include other geolocation information here -->
<h2>Links:</h2>
<p class="link"><a href="{url_maps}" target="_blank">Google Maps</a></p>
<p class="link"><a href="{url_IP}" target="_blank">WhatIsMyIPAddress</a></p>
</div>
</div>
</body>
</html>
"""
# Save HTML content to a file
output_file_path = f"logs/{IP}.html"
with open(output_file_path, "w") as html_file:
html_file.write(html_content)
print(f"{Fore.GREEN}HTML log saved in: {Fore.BLUE}{output_file_path}{Fore.GREEN}!{Fore.RESET}")
print(f'Quieres abrir algún enlace? ({Fore.GREEN}s{Fore.RESET}/{Fore.RED}n{Fore.RESET}) --> ', end="")
r = str(input()).lower()
if r == "s":
print(f'{Fore.GREEN} 1. {Fore.LIGHTWHITE_EX}Google Maps')
print(f'{Fore.GREEN} 2. {Fore.LIGHTWHITE_EX }Whatismyipaddress')
print(f'{Fore.GREEN} 3. {Fore.LIGHTWHITE_EX}Todo{Fore.RESET}')
print()
print(f'Respuesta: {Fore.BLUE}', end="")
nav = int(input())
print(Fore.RESET)
if nav == 1:
webbrowser.open(url_maps)
exit()
elif nav == 2:
webbrowser.open(url_IP)
exit()
elif nav == 3:
webbrowser.open(url_maps)
webbrowser.open(url_IP)
exit()
else:
print(f'{Fore.RESET}Respuesta no válida')
print()
elif r == "n":
exit()
else:
print("Respuesta no válida")