Last active
August 23, 2023 20:21
-
-
Save azuax/02e8c5cda7573face773 to your computer and use it in GitHub Desktop.
Script simple para un generador de contraseñas para un ataque de fuerza bruta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import argparse | |
""" Asumimos que las contraseñas sólo pueden ser alfanuméricas """ | |
# seteamos las opciones 0-9: | |
opciones = [u'%s' % x for x in range(10)] | |
# agregamos A-Z (mayúsculas): | |
opciones.extend([chr(x) for x in range(65, 91)]) | |
# # y agregamos a-z (minúsculas): | |
opciones.extend([chr(x) for x in range(97, 123)]) | |
def crear_passwords(l, inicial=''): | |
global opciones | |
if l == 0: | |
return | |
for x in opciones: | |
password = inicial + x | |
# acá probaríamos la contraseña contra nuestro servicio o | |
# compararíamos contra el hash que tengamos (previo cifrado) | |
print password | |
crear_passwords(l - 1, password) | |
def main(): | |
parser = argparse.ArgumentParser(prog='Brute Force') | |
parser.add_argument('-l', '--limite', help='Largo máximo de la contraseña', required=True) | |
values = parser.parse_args() | |
crear_passwords(int(values.limite)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/usr/bin/env python
-- coding: utf-8 --
import argparse
""" Asumimos que las contraseñas sólo pueden ser alfanuméricas """
seteamos las opciones 0-9:
opciones = [u'%s' % x for x in range(10)]
agregamos A-Z (mayúsculas):
opciones.extend([chr(x) for x in range(65, 91)])
# y agregamos a-z (minúsculas):
opciones.extend([chr(x) for x in range(97, 123)])
def crear_passwords(l, inicial=''):
global opciones
def main():
parser = argparse.ArgumentParser(prog='Brute Force')
parser.add_argument('-l', '--limite', help='Largo máximo de la contraseña', required=True)
if name == 'main':
main()