-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecon.py
More file actions
168 lines (125 loc) · 4.03 KB
/
Copy pathrecon.py
File metadata and controls
168 lines (125 loc) · 4.03 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
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
"""
ReconPy - Herramienta de Reconocimiento OSINT Pasivo
Este script realiza reconocimiento pasivo sobre un dominio, recopilando
información pública disponible, como:
- Dirección IP
- Registros DNS
- Encabezados HTTP
- Archivo robots.txt
- Certificado SSL
- Información WHOIS
- Datos RDAP
Uso:
python recon.py <dominio o URL>
Ejemplo:
python recon.py example.com
python recon.py https://example.com
Nota:
Esta herramienta es solo para fines educativos y debe utilizarse
únicamente sobre objetivos autorizados.
"""
import sys
import time
from pyfiglet import figlet_format
from colorama import Fore, Style, init
from urllib.parse import urlparse
# Importación de módulos personalizados
from modules.dns_info import get_ip, get_dns_records
from modules.http_info import get_http_headers, get_robots_txt
from modules.ssl_info import get_ssl_certificate_info
from modules.rdap_info import get_whois_info, get_rdap_info
from modules.utils import print_section, pretty_print
# Inicializa colorama para permitir colores en la terminal
init(autoreset=True)
def show_banner():
"""
Muestra el banner de la herramienta en la consola.
Incluye:
- Nombre de la herramienta
- Versión
- Autor
- Descripción
Se utilizan pequeños delays para mejorar la experiencia visual.
"""
banner = figlet_format("ReconPy", font="colossal")
print(Fore.LIGHTWHITE_EX + "\n### ReconPy v1.0.0 ###\n")
print(Fore.RED + banner)
time.sleep(0.9)
print(Fore.GREEN + "[+] Developed by Matias")
time.sleep(0.9)
print(Fore.YELLOW + "[+] Passive OSINT Recon Tool\n")
time.sleep(0.9)
print(Style.RESET_ALL)
def normalize_target(target: str) -> str:
"""
Normaliza la entrada del usuario (dominio o URL) y extrae el hostname.
Permite entradas como:
- example.com
- www.example.com
- https://example.com
- https://example.com/blog
- http://example.com:8080/test
Retorna:
str: dominio limpio (hostname) o cadena vacía si no es válido.
"""
target = target.strip()
if not target:
return ""
# Si no incluye esquema (http/https), se agrega temporalmente
# para que urlparse pueda procesarlo correctamente
if not target.startswith(("http://", "https://")):
target = "https://" + target
parsed = urlparse(target)
# hostname elimina automáticamente el puerto si existe
hostname = parsed.hostname
if not hostname:
return ""
return hostname
def main():
"""
Función principal del programa.
Responsabilidades:
- Mostrar el banner
- Validar los argumentos de entrada
- Normalizar el dominio o URL ingresado
- Ejecutar los módulos OSINT
- Mostrar los resultados en consola de forma estructurada
Argumentos esperados:
sys.argv[1]: dominio o URL a analizar
"""
show_banner()
# Validación de argumentos
if len(sys.argv) != 2:
print("Uso: python recon.py <dominio o URL>")
sys.exit(1)
# Normaliza la entrada del usuario
domain = normalize_target(sys.argv[1])
if not domain:
print("Error: no se pudo extraer un dominio válido.")
sys.exit(1)
# Mensaje informativo
print("Herramienta OSINT educativa")
print("Uso exclusivo sobre información pública y objetivos autorizados.\n")
# Obtención de IP
print_section("IP")
print(get_ip(domain))
# Obtención de registros DNS
print_section("DNS")
pretty_print(get_dns_records(domain))
# Obtención de encabezados HTTP
print_section("HTTP Headers")
pretty_print(get_http_headers(domain))
# Obtención de robots.txt
print_section("robots.txt")
print(get_robots_txt(domain))
# Obtención de certificado SSL
print_section("SSL")
pretty_print(get_ssl_certificate_info(domain))
# Información WHOIS
print_section("WHOIS")
pretty_print(get_whois_info(domain))
# Información RDAP
print_section("RDAP")
pretty_print(get_rdap_info(domain))
if __name__ == "__main__":
main()