Crackeador MD5 por Fuerza bruta
Aca les dejo este crackeador por fuerza bruta. Funciona de maravilla aunque no es muy rapido por el lenguaje. Quizas les sirva como ejemplo.
Modo de uso:
Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -vComandos:
-t: Tipo de Hash -h: Hash a Crackear -w: Teclas a usar -a: Maximo de Caracteres -i: Minimo de Caracteres -v: Modo HackingCodigo Fuente:
import sys , string , time def main(): "Main" title = "MD5 Cracker Brute Force" print "\n" + title.center(45) + "\n" def usage(): "Usage" print "[+] Ejemplo : Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v" def usagelarge(): "Usage Large" print "\n Forma de Uso:" print "\n [+]Ejemplo: Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v" print "" print "\t[Comandos]" print "\t -t: Tipo de Hash" print "\t -h: Hash a Crackear" print "\t -w: Teclas a usar" print "\t -a: Maximo de Caracteres" print "\t -i: Minimo de Caracteres" print "\t -v: Modo Hacking\n" def timer(): "Time" now = time.localtime(time.time()) return time.asctime(now) if '__main__' == __name__ : if len(sys.argv) <= 5: main() usagelarge() sys.exit(1) hhash = words = maxw = minw = typeh = "" verbose = 0 for arg in sys.argv[1:]: try: if arg.lower() == "-v" or arg.lower() == "-verbose": verbose = 1 if arg.lower() == "-h" or arg.lower() == "-hash": hhash = sys.argv[int(sys.argv[1:].index(arg))+2] if arg.lower() == "-a" or arg.lower() == "-max": maxw = sys.argv[int(sys.argv[1:].index(arg))+2] if arg.lower() == "-i" or arg.lower() == "-min": minw = sys.argv[int(sys.argv[1:].index(arg))+2] if arg.lower() == "-w" or arg.lower() == "-words": words = sys.argv[int(sys.argv[1:].index(arg))+2] if arg.lower() == "-t" or arg.lower() == "-type": typeh = sys.argv[int(sys.argv[1:].index(arg))+2] except(IndexError): print "[+] Comandos Obligatorios -t(Tipo de Hash) -h(Hash) -w(Teclas) -a(Maximo de teclas) -a(Minimo de teclas)" usage() sys.exit(1) if minw == "" : minw = '1' main() for args in (typeh, hhash, words, maxw, minw): try: if args != "": if args == typeh : if typeh.lower() != 'md5' or 'sha': if typeh.lower() == "md5" : typeh = '1' print "[+] Tipo de Hash : MD5" elif typeh.lower() == "sha" : typeh = '2' print "[+] Tipo de Hash : SHA1" else: print "[+] Tipo Invalido de Hash" sys.exit(1) if args == hhash : if typeh == '1' : if len(hhash) == 32 : print "[+] MD5 Hash : " + hhash else: print "[+] Tipo Invalido de Hash" sys.exit(1) if typeh == '2' : if len(hhash) == 40 : print "[+] SHA1 Hash : " + hhash else: print "[+] SHA1 Invalido" sys.exit(1) if args == words : print "[+] Teclas a usar : " + words if args == maxw : if maxw.isdigit() != False : if int(maxw) >= 15 : print "[+] Maximo de Digitos : 15 : " + maxw sys.exit(1) else: if int(maxw) > int(minw): print "[+] Maximo de Digitos : " + maxw else: print "[+] El Maximo de Digitos debe ser mayor al Minimo de Digitos" sys.exit(1) else: print "[+] Maximo de Teclas = Digitos" sys.exit(1) if args == minw : if minw.isdigit() != False : if int(minw) < int(maxw) : print "[+] Minimo de Digitos : " + minw else: print "[+] El minimo de Digitos debe ser menor al maximo de Digitos" sys.exit(1) else: print "[+] Minimo de Teclas = Digitos" sys.exit(1) else: print "[+] Comandos Obligatorios -t(Tipo de Hash) -h(Hash) -w(Teclas) -a(Maximo de teclas) -a(Minimo de teclas)" usage() sys.exit(1) except(ValueError): print "[+] Formato de comandos erroneo" sys.exit(1) f = open("CRACK.py",'w') f.write("#!/usr/bin/env python\n") if (typeh == '1') : f.write("import sys , md5 , string , time\n") if (typeh == '2') : f.write("import sys , sha , string , time\n") tab = '\t' f.write("def timer():\n") f.write(tab + "now = time.localtime(time.time())\n") f.write(tab + "return time.asctime(now)\n") f.write("def crackhash():\n") i = 0 ; inwords = "" f.write(tab + "hashh = '" + hhash.lower() +"'\n") f.write(tab + "try:\n") #print words for i in words: if i == str(words[int(len(words)-1)]) : inwords += "'" + i + "'" break inwords += "'" + i + "'," #print inwords i = int(minw) ; iwords = "" ; a = 0 while (int(i) != int(maxw) + 1) : for a in range(i): if int(i) != (int(a) + 1): iwords += "i" + str(i) + str(a) + " + " else: iwords += "i" + str(i) + str(a) data = (int(a + 2) * tab + "for i" + str(i) + str(a) + " in (" + inwords + "):\n") f.write(data) f.write(int(i + 2) * tab + "word = '' ; value = ''\n") f.write(int(i + 2) * tab + "word = " + iwords + "\n") if typeh == '1' : f.write(int(i + 2) * tab + "hash = md5.new()\n") if typeh == '2' : f.write(int(i + 2) * tab + "hash = sha.new()\n") f.write(int(i + 2) * tab + "hash.update(str(word))\n") f.write(int(i + 2) * tab + "value = hash.hexdigest()\n") if verbose == 1 : f.write(int(i + 2) * tab + "print " + iwords + ' + " : " + str(value)\n') f.write(int(i + 2) * tab + "if str(hashh) == str(value):\n") f.write(int(i + 3) * tab + "raise Exception\n") iwords = "" i += 1 f.write(tab + "except(Exception):") f.write('\n'+ 2 * tab + "print '******************** Hash Crackeado ' + 20 * '*'") f.write('\n' + 2 * tab + "print '[+] HASH :', hashh") f.write('\n' + 2 * tab + "print '[+] PASS :', str(word)") f.write('\n' + 2 * tab + "print '[+] Hora de finalizacion :', timer()") f.write('\n' + 2 * tab + "sys.exit(1)") f.write('\n' + tab + "except(KeyboardInterrupt):") f.write('\n' + 2 * tab + "print '[+] Process Ended ',timer()") f.write('\n' + 2 * tab + "sys.exit(1)") f.write("\ncrackhash()") f.close() print '[+] Hora de inicio : ', timer() import CRACK CRACK.crackhash()