-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexploits.py
More file actions
47 lines (35 loc) · 1.73 KB
/
exploits.py
File metadata and controls
47 lines (35 loc) · 1.73 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
import subprocess
from termcolor import colored
def search_exploits(service_info):
print(colored("[INFO] Buscando exploits disponibles...", "blue"))
exploits = []
for service in service_info:
service_version = service['version']
print(colored(f"[DEBUG] Buscando exploits para {service_version}", "cyan"))
if service_version:
# Construir comando para ejecutar searchsploit solo con la versión del servicio
command = f"searchsploit {service_version}"
try:
output = subprocess.check_output(command, shell=True, text=True)
exploits += parse_searchsploit_output(output)
except subprocess.CalledProcessError as e:
print(colored(f"[ERROR] Error al ejecutar searchsploit: {e}", "red"))
return exploits
def parse_searchsploit_output(output):
exploits = []
lines = output.splitlines()
for line in lines:
# Filtrar líneas que contienen información sobre exploits
if "|" in line and not line.startswith("Exploit Title") and not line.startswith("Shellcodes:") and not line.startswith("Exploits:"):
exploits.append(line)
return exploits
def exploit_vulnerabilities(target, service_info):
exploits = search_exploits(service_info)
if exploits:
print(colored("[INFO] Exploits disponibles:", "green"))
for exploit in exploits:
print(colored(exploit, "yellow"))
print(colored("[INFO] Para descargar un exploit, usa: searchsploit -m <PATH>", "blue"))
else:
print(colored("[INFO] No se encontraron exploits disponibles.", "yellow"))
print(colored("[INFO] Explotación completa.", "green"))