-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmartscan.py
More file actions
91 lines (71 loc) · 3.12 KB
/
Copy pathsmartscan.py
File metadata and controls
91 lines (71 loc) · 3.12 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
#!/usr/bin/env python3
import argparse
import dns.resolver
import httpx
import sys
def dns_scan(domain):
"""Escaneo DNS básico"""
print(f"[*] Realizando escaneo DNS de: {domain}")
record_types = ['A', 'AAAA', 'MX', 'NS', 'TXT', 'CNAME']
for record in record_types:
try:
answers = dns.resolver.resolve(domain, record)
for rdata in answers:
print(f" {record}: {rdata}")
except Exception as e:
print(f" {record}: No encontrado o error")
def http_scan(domain):
"""Escaneo HTTP básico"""
print(f"[*] Realizando escaneo HTTP de: {domain}")
try:
# Probar HTTP y HTTPS
for scheme in ['https', 'http']:
url = f"{scheme}://{domain}"
try:
with httpx.Client(timeout=10) as client:
response = client.get(url)
print(f" {scheme.upper()}: {response.status_code} - {url}")
# Mostrar headers interesantes
security_headers = ['server', 'x-powered-by', 'x-frame-options']
for header in security_headers:
if header in response.headers:
print(f" {header}: {response.headers[header]}")
except Exception as e:
print(f" {scheme.upper()}: Error - {e}")
except Exception as e:
print(f" Error en escaneo HTTP: {e}")
def cve_scan(domain):
"""Escaneo básico de tecnologías (para detectar CVEs potenciales)"""
print(f"[*] Buscando tecnologías vulnerables en: {domain}")
try:
with httpx.Client(timeout=10) as client:
response = client.get(f"https://{domain}")
# Detectar tecnologías por headers
server = response.headers.get('server', 'Desconocido')
powered_by = response.headers.get('x-powered-by', 'Desconocido')
print(f" Servidor: {server}")
print(f" Tecnología: {powered_by}")
print(" [INFO] Para análisis CVE avanzado necesitarías integración con bases de datos CVE")
except Exception as e:
print(f" Error en escaneo CVE: {e}")
def main():
parser = argparse.ArgumentParser(description='SmartScan - Herramienta de escaneo de seguridad')
parser.add_argument('-H', '--host', required=True, help='Dominio a escanear')
parser.add_argument('--dns', action='store_true', help='Realizar escaneo DNS')
parser.add_argument('--http','--web', action='store_true', help='Realizar escaneo HTTP/Web')
parser.add_argument('--cve', action='store_true', help='Buscar CVEs potenciales')
args = parser.parse_args()
print(f"[+] Iniciando SmartScan para: {args.host}")
print("=" * 50)
if args.dns:
dns_scan(args.host)
print()
if args.http or not (args.dns or args.http or args.cve):
http_scan(args.host)
print()
if args.cve:
cve_scan(args.host)
print()
print("[+] Escaneo completado")
if __name__ == "__main__":
main()