Foro de elhacker.net

Seguridad Informática => Criptografía => Mensaje iniciado por: [ANTRAX] en 7 Septiembre 2010, 21:27 pm



Título: Crackeador MD5 por Fuerza bruta
Publicado por: [ANTRAX] en 7 Septiembre 2010, 21:27 pm
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:

Código:
Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v

Comandos:

Código:
-t: Tipo de Hash
-h: Hash a Crackear
-w: Teclas a usar
-a: Maximo de Caracteres
-i: Minimo de Caracteres
-v: Modo Hacking

Código
  1. import sys , string , time
  2. def main():
  3.    "Main"
  4.    title = "MD5 Cracker Brute Force"
  5.    print "\n" + title.center(45) + "\n"
  6.  
  7. def usage():
  8.    "Usage"
  9.    print "[+] Ejemplo : Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v"
  10.  
  11. def usagelarge():
  12.    "Usage Large"
  13.    print "\n  Forma de Uso:"
  14.    print "\n  [+]Ejemplo: Cracker.py -t md5 -h e10adc3949ba59abbe56e057f20f883e -w 1234567890 -a 9 -i 3 -v"
  15.    print ""
  16.    print "\t[Comandos]"
  17.    print "\t   -t: Tipo de Hash"
  18.    print "\t   -h: Hash a Crackear"
  19.    print "\t   -w: Teclas a usar"
  20.    print "\t   -a: Maximo de Caracteres"
  21.    print "\t   -i: Minimo de Caracteres"
  22.    print "\t   -v: Modo Hacking\n"
  23.  
  24. def timer():
  25.    "Time"
  26.    now = time.localtime(time.time())
  27.    return time.asctime(now)
  28.  
  29. if '__main__' == __name__ :
  30.  
  31.    if len(sys.argv) <= 5:
  32.        main()
  33.        usagelarge()
  34.        sys.exit(1)
  35.  
  36.    hhash = words = maxw = minw = typeh = ""
  37.    verbose = 0
  38.  
  39.    for arg in sys.argv[1:]:
  40.        try:
  41.            if arg.lower() == "-v" or arg.lower() == "-verbose":
  42.                    verbose = 1
  43.            if arg.lower() == "-h" or arg.lower() == "-hash":
  44.                    hhash = sys.argv[int(sys.argv[1:].index(arg))+2]
  45.            if arg.lower() == "-a" or arg.lower() == "-max":
  46.                    maxw = sys.argv[int(sys.argv[1:].index(arg))+2]
  47.            if arg.lower() == "-i" or arg.lower() == "-min":
  48.                    minw = sys.argv[int(sys.argv[1:].index(arg))+2]
  49.            if arg.lower() == "-w" or arg.lower() == "-words":
  50.                    words = sys.argv[int(sys.argv[1:].index(arg))+2]
  51.            if arg.lower() == "-t" or arg.lower() == "-type":
  52.                    typeh = sys.argv[int(sys.argv[1:].index(arg))+2]
  53.        except(IndexError):
  54.            print "[+] Comandos Obligatorios -t(Tipo de Hash) -h(Hash) -w(Teclas) -a(Maximo de teclas) -a(Minimo de teclas)"
  55.            usage()
  56.            sys.exit(1)
  57.  
  58.    if minw == "" : minw = '1'
  59.  
  60.    main()
  61.    for args in (typeh, hhash, words, maxw, minw):
  62.        try:
  63.            if args != "":
  64.                if args == typeh :
  65.                    if typeh.lower() != 'md5' or 'sha':
  66.                        if typeh.lower() == "md5" :
  67.                            typeh = '1'
  68.                            print "[+] Tipo de Hash : MD5"
  69.                        elif typeh.lower() == "sha" :
  70.                            typeh = '2'
  71.                            print "[+] Tipo de Hash : SHA1"
  72.                    else:
  73.                        print "[+] Tipo Invalido de Hash"
  74.                        sys.exit(1)
  75.                if args == hhash :
  76.                    if typeh == '1' :
  77.                        if len(hhash) == 32 :
  78.                            print "[+] MD5 Hash : " + hhash
  79.                        else:
  80.                            print "[+] Tipo Invalido de Hash"
  81.                            sys.exit(1)
  82.                    if typeh == '2' :
  83.                        if len(hhash) == 40 :
  84.                            print "[+] SHA1 Hash : " + hhash
  85.                        else:
  86.                            print "[+] SHA1 Invalido"
  87.                            sys.exit(1)
  88.                if args == words :
  89.                    print "[+] Teclas a usar : " + words
  90.                if args == maxw :
  91.                    if maxw.isdigit() != False :
  92.                        if int(maxw) >= 15 :
  93.                            print "[+] Maximo de Digitos : 15 : " + maxw
  94.                            sys.exit(1)
  95.                        else:
  96.                            if int(maxw) > int(minw):
  97.                                print "[+] Maximo de Digitos : " + maxw
  98.                            else:
  99.                                print "[+] El Maximo de Digitos debe ser mayor al Minimo de Digitos"
  100.                                sys.exit(1)
  101.                    else:
  102.                        print "[+] Maximo de Teclas = Digitos"
  103.                        sys.exit(1)
  104.                if args == minw :
  105.                        if minw.isdigit() != False :
  106.                            if int(minw) < int(maxw) :
  107.                                print "[+] Minimo de Digitos : " + minw
  108.                            else:
  109.                                print "[+] El minimo de Digitos debe ser menor al maximo de Digitos"
  110.                                sys.exit(1)
  111.                        else:
  112.                            print "[+] Minimo de Teclas = Digitos"
  113.                            sys.exit(1)
  114.            else:
  115.                print "[+] Comandos Obligatorios -t(Tipo de Hash) -h(Hash) -w(Teclas) -a(Maximo de teclas) -a(Minimo de teclas)"
  116.                usage()
  117.                sys.exit(1)
  118.        except(ValueError):
  119.            print "[+] Formato de comandos erroneo"
  120.            sys.exit(1)
  121.  
  122.    f = open("CRACK.py",'w')
  123.    f.write("#!/usr/bin/env python\n")
  124.    if (typeh == '1') : f.write("import sys , md5 , string , time\n")
  125.    if (typeh == '2') : f.write("import sys , sha , string , time\n")
  126.    tab = '\t'
  127.    f.write("def timer():\n")
  128.    f.write(tab + "now = time.localtime(time.time())\n")
  129.    f.write(tab + "return time.asctime(now)\n")
  130.    f.write("def crackhash():\n")
  131.  
  132.    i = 0 ; inwords = ""
  133.    f.write(tab + "hashh = '" + hhash.lower() +"'\n")
  134.    f.write(tab + "try:\n")
  135.  
  136.    #print words
  137.    for i in words:
  138.        if i == str(words[int(len(words)-1)]) :
  139.            inwords += "'" + i + "'"
  140.            break
  141.        inwords += "'" + i + "',"
  142.    #print inwords
  143.  
  144.    i = int(minw) ; iwords = "" ; a = 0
  145.  
  146.    while (int(i) != int(maxw) + 1) :
  147.  
  148.        for a in range(i):
  149.            if int(i) != (int(a) + 1):
  150.                iwords += "i" + str(i) + str(a) + " + "
  151.            else:
  152.                 iwords += "i" + str(i) + str(a)
  153.  
  154.            data = (int(a + 2) * tab + "for i" + str(i) + str(a) + " in (" + inwords + "):\n")
  155.            f.write(data)
  156.  
  157.        f.write(int(i + 2) * tab + "word = '' ; value = ''\n")
  158.        f.write(int(i + 2) * tab + "word = " + iwords + "\n")
  159.  
  160.        if typeh == '1' : f.write(int(i + 2) * tab + "hash = md5.new()\n")
  161.  
  162.        if typeh == '2' : f.write(int(i + 2) * tab + "hash = sha.new()\n")
  163.  
  164.        f.write(int(i + 2) * tab + "hash.update(str(word))\n")
  165.        f.write(int(i + 2) * tab + "value = hash.hexdigest()\n")
  166.        if verbose == 1 : f.write(int(i + 2) * tab + "print " + iwords + ' + " : " + str(value)\n')
  167.        f.write(int(i + 2) * tab + "if str(hashh) == str(value):\n")
  168.        f.write(int(i + 3) * tab + "raise Exception\n")
  169.        iwords = ""
  170.        i += 1
  171.  
  172.    f.write(tab + "except(Exception):")
  173.    f.write('\n'+ 2 * tab + "print '********************  Hash Crackeado ' + 20 * '*'")
  174.    f.write('\n' + 2 * tab + "print '[+] HASH :', hashh")
  175.    f.write('\n' + 2 * tab + "print '[+] PASS :', str(word)")
  176.    f.write('\n' + 2 * tab + "print '[+] Hora de finalizacion :', timer()")
  177.    f.write('\n' + 2 * tab + "sys.exit(1)")
  178.    f.write('\n' + tab + "except(KeyboardInterrupt):")
  179.    f.write('\n' + 2 * tab + "print '[+] Process Ended ',timer()")
  180.    f.write('\n' + 2 * tab + "sys.exit(1)")
  181.    f.write("\ncrackhash()")
  182.    f.close()
  183.  
  184.    print '[+] Hora de inicio : ', timer()
  185.  
  186.    import CRACK
  187.    CRACK.crackhash()



Saludos!


Título: Re: Crackeador MD5 por Fuerza bruta
Publicado por: Shell Root en 29 Octubre 2010, 17:58 pm
jjajjjajajajjajajajajajjajaja


Título: Re: Crackeador MD5 por Fuerza bruta
Publicado por: APOKLIPTICO en 29 Octubre 2010, 18:03 pm
Shell Root, ya es el segundo mensaje que veo que respondés asi. Si no tenes algo que aportar, no respondas.

PD: que velocidad tiene el cracker? Poné tus specs y si podes los FLOPS que llega tu pc.