-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtracker.py
128 lines (112 loc) · 4.63 KB
/
tracker.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
import requests
import os
import phonenumbers
from phonenumbers import geocoder
from phonenumbers import carrier
os.system("clear")
print("")
print("\033[34m ._____________ ___________ __ \033[0m")
print("\033[34m | \______ \ \__ ___/___________ ____ | | __ ___________ \033[0m")
print("\033[34m | || ___/ ______ | | \_ __ \__ \ _/ ___\| |/ // __ \_ __ \ \033[0m")
print("\033[34m | || | /_____/ | | | | \// __ \\ \___| <\ ___/| | \/ \033[0m")
print("\033[34m |___||____| |____| |__| (____ /\___ >__|_ \\___ >__| \033[0m")
print("\033[34m \/ \/ \/ \/ \033[0m")
def menu_principal():
while True:
print("\n[1] Obtener geolocalizacion de una IP")
print("[2] Obtener informacion del número de teléfono")
print("[3] Salir")
opcion = input("\033[1m\n[+] Ingrese una opción: \033[0m")
if opcion == "":
print("\033[1m\n[+] Por favor ingrese una opción: \033[0m")
elif opcion == "1":
menu1()
elif opcion == "2":
menu2()
elif opcion == "3":
break
def menu1():
while True:
print("\n[1] Método 1")
print("[2] Método 2")
print("[99] Volver al menu")
opcion = input("\033[1m\n[+] Ingrese una opción: \033[0m")
if opcion == "":
print("\033[1m\n[+] Por favor ingrese una opción: \033[0m")
elif opcion == "1":
ip_address = input("\033[1m\nIngrese la Dirección IP: \033[0m") # Dirección IP de ejemplo
url = f'http://ip-api.com/json/{ip_address}'
response = requests.get(url)
if response.status_code == 200:
data = response.json()
country = data["country"]
city = data["city"]
lat = data["lat"]
lon = data["lon"]
with open("IP.txt", "w+") as file:
file.write(f'Pais: {country}\n')
file.write(f'Ciudad: {city}\n')
file.write(f'Latitud: {lat}\n')
file.write(f'Longitud: {lon}\n')
print(f'\nPaís: {country}')
print(f'Ciudad: {city}')
print(f'Latitud: {lat}')
print(f'Longitud: {lon}\n')
elif opcion == "2":
def ip_info(ip_address):
url = f"https://ipinfo.io/{ip_address}/json"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
ip = data["ip"]
hostname = data["hostname"]
city = data["city"]
region = data["region"]
country = data["country"]
postal = data["postal"]
latitude = data["loc"]
longitude = data["loc"]
with open("IP2.txt", "w+") as file:
file.write(f'IP address: {ip}\n')
file.write(f'Hostname: {hostname}\n')
file.write(f'City: {city}\n')
file.write(f'Region: {region}\n')
file.write(f'Country: {country}\n')
file.write(f'Postal code: {postal}\n')
file.write(f'Latitude: {latitude}\n')
file.write(f'Longitude: {longitude}\n')
data = response.json()
print(f"IP address: {data['ip']}")
print(f"Hostname: {data['hostname']}")
print(f"City: {data['city']}")
print(f"Region: {data['region']}")
print(f"Country: {data['country']}")
print(f"Postal code: {data['postal']}")
print(f"Latitude: {data['loc'].split(',')[0]}")
print(f"Longitude: {data['loc'].split(',')[1]}")
ip_address = input("\033[1m\nEnter an IP address: \033[0m")
ip_info(ip_address)
elif opcion == "99":
menu_principal()
def menu2():
while True:
country = input("País (sin +): ")
number = input("Número: ")
print("")
victim_number = '+' + country + number
# Crear un objeto PhoneNumber con el número de teléfono
phone_number = phonenumbers.parse(victim_number)
# Guardar la salida en un archivo llamado "número.txt"
with open("número.txt", "w") as f:
f.write("Numero valido: {}\n".format(phonenumbers.is_valid_number(phone_number)))
f.write("Numero posible: {}\n".format(phonenumbers.is_possible_number(phone_number)))
f.write("Numero: {}\n".format(phonenumbers.format_number(phone_number, phonenumbers.PhoneNumberFormat.E164)))
f.write("Geolocalizacion: {}\n".format(phonenumbers.geocoder.description_for_number(phone_number, "en")))
f.write("Operador: {}\n".format(phonenumbers.carrier.name_for_number(phone_number, "ec")))
print("Numero valido: {}".format(phonenumbers.is_valid_number(phone_number)))
print("Numero posible: {}".format(phonenumbers.is_possible_number(phone_number)))
print("Numero: {}".format(phonenumbers.format_number(phone_number, phonenumbers.PhoneNumberFormat.E164)))
print("Geolocalizacion: {}".format(phonenumbers.geocoder.description_for_number(phone_number, "en")))
print("Operador: {}".format(phonenumbers.carrier.name_for_number(phone_number, "ec")))
print("")
menu_principal()