HASHorator [MD5 cracker]

Iniciado por Xt3mP, Abril 16, 2012, 03:58:23 AM

Tema anterior - Siguiente tema

0 Miembros y 2 Visitantes están viendo este tema.

HASHorator es una aplicación que programé ya hace un tiempo en PHP la cual tiene como fin tratar de decifrar por manera inversa a base de otras páginas con base de datos de hash anteriormente creados para tratar de encontrar un match.


Por el momento cuenta con 13 páginas sin dejar a un lado la opción de meter un diccionario, a continuación explico un poco más las características de este pequeño pero útil script:




Select cipher type/Seleccionar tipo de cifrado:
  • MD5 ($pass)
  • SHA1 ($pass)
  • SMF ($salt.$pass)
    Put HASH/Ingresar HASH:
  • Mediante expresiones regulares se puede tratar de comprobar que el hash ingresado sea el correcto ([a-f0-9]{long}).
    Put SALT/Ingresar SALT:
  • Opción solo disponible para SMF
    Dictionary/Diccionario:
    Opción disponible para los 3 tipos de cifrados, en la variable $max se especifica el máximo de palabras por diccionario.
  • Stop processing if there's a positive match/Parar el procesamiento al primer resultado positivo:
    Opción para detener el script al primer resultado positivo; esto puede acelerar el tiempo de ejecución del script (recomendable).


    Tengo una página que rompe MD5 pero no se como agregarla al script:
    El script tiene como motor el array multidimensional $data el cual contiene 4 arrays importantes:

        pages: Contiene la página a donde se enviará la petición POST o GET por cURL.
        parameters: Los parámetros del formulario o de la URL.
        sustitution: Las expresiones regulares para sacar exclusivamente el resultado (en caso de ser positivo).
        security: Para eliminar etiquetas repetidas.

    Tomaremos de ejemplo la página You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login, al nosotros ingresar un hash para desencriptar nos regresará:
    Citar<b>Md5 Hash:</b> dc02aab0ea69aab5be23c7d966bd04a1<br/><br/><img src="line.gif"/><br/><br/><b><font size="2">Decrypted Text: </font></b><font size="2">[email protected]</font>

    Por lo tanto, nuestro array multidimensional debe constar de:
  • pages: La página a donde hace referencia; si es por GET en vez por URL se pone la url You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login o You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login según sea el caso y los parámetros se ponen como null.
  • parameters: Parámetros del formulario; si es por GET la petición se pone null.
  • sustitution: La expresión regular
  • security: Generalmente null si no se repiten tags

    Código con ejemplo POST y GET:
    Código: php
    <?php
    $data = array(
        'pages' => array(
            0 => 'http://md5decryption.com/'
            1 => 'http://md5.rednoize.com/?q='.$hash
        ),
        'parameters' => array(
            0 => 'hash='.$hash.'&submit=Decrypt It!'
            1 => null
        ),
        'sustitution' => array(
            0 => "/Decrypted Text: <\/b>(.*)<\/font>/"
            1 => "/<div id=\"result\" >(.*)<\/div>/"
        ),
        'security' => array(
            0 => null
            1 => null
        )
    );
    ?>

    Recordemos que el 0 y 1 debe ser el número siguiente, en este caso, si tratamos de añadir una página más sería el 2 =>.
    Código: php
    <?php
    /*
    * Name: Hashorator
    * Author: Xt3mP
    * Contact: xt3mp[at]null[dot]net
    * Bugs: xt3mp[at]null[dot]net
    * Personal website: http://xt3mp.mx
    * Website: http://backroot.org
    * Version: 1.0 BETA
    */
    set_time_limit(0); //30 seconds default
    $max = 100000; //Max words per dictionary
    ?>
    <title>Hashorator v1.0 [Xt3mP]</title>
    <style type="text/css">body{font-family:Courier;background-color:#000;color:#FFF;font-size:13px}div#container{width:690px;height:auto;border:1px dashed #FFF;margin:0 auto}div#container a{text-decoration:none;color:#FF5B5B}div#container a:hover{color:#FFF}div#menu{width:100%;height:auto;border-top:1px dashed #FFF;border-bottom:1px dashed #FFF;text-align:center}div.border{border-top:1px dashed #FFF;text-align:center;color:red}div#container input{background-color:#FFF;color:#000;border:1px solid #FFF;font-family:Courier;cursor:pointer;text-align:center;padding:5px}pre.none{width:auto;margin:0;padding:0}div#result{width:100%;height:auto;font-size:12px}div#container textarea{border:1px solid #FFF}</style>
    <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
    <script>$(function(){$("#salt").css("background-color","#999").attr("disabled",true);$("#dic").css("background-color","#999").attr("disabled",true);$("#usedic").click(function(){if($("#dic").attr("disabled")==true){$("#dic").attr("disabled",false).css("background-color","#FFF").css("color","#000");$("#dictionary").val("yes")}else{$("#dic").attr("disabled",true).val("").css("background-color","#999");$("#dictionary").val("no")}});$("#type").change(function(){var a=$("select#type option:selected").val();if(a=="mysql"){$("#salt").css("background-color","#999").val("").attr("disabled",true);$("#dic").css("background-color","#999").val("").attr("disabled",true);$("#usedic").attr("disabled",true).attr("checked",false);$("#dictionary").val("no")}else if(a=="smf"){$("#salt").css("background-color","#FFF").css("color","#000").attr("disabled",false);$("#dic").css("background-color","#FFF").val("").attr("disabled",false);$("#usedic").attr("disabled",true).attr("checked",true);$("#dictionary").val("yes")}else{$("#salt").css("background-color","#999").val("").attr("disabled",true);$("#dic").css("background-color","#999").attr("disabled",true);$("#usedic").attr("disabled",false).attr("checked",false);$("#dictionary").val("no")}})})</script>
    <div id="container">
    <pre>
             ___ ___                __                         __ Hashorator v1.0
            |   Y   |.---.-..-----.|  |--..-----..----..---.-.|  |_ .-----..----.
            |.  1   ||  _  ||__ --||     ||  _  ||   _||  _  ||   _||  _  ||   _|
            |.  _   ||___._||_____||__|__||_____||__|  |___._||____||_____||__|
            |:  |   |
            |::.|:. |                                         Powered By Xt3mP
            `--- ---'                                       xt3mp[at]null[dot]net
    </pre>
    <div id="menu">
            <form action="" method="POST">
            Select cipher type:
            <select name="type" id="type">
                    <option value="md5">MD5</option>
                    <option value="sha1">SHA1</option>
                    <!-- <option value="mysql">MySQL</option> -->
            <option value="smf">SMF</option>
            </select><br />
            Put HASH: <br />
            <input type="text" name="hash" value="" maxlength="40" size="41"/><br />
            Put SALT <a href="#">(?)</a>: <br />
            <input type="text" name="salt" id="salt" value="" maxlength="40" size="41"/><br />
            Dictionary: <input type="checkbox" id="usedic" name="usedic" value="yes"><br />
            <input type="hidden" value="no" id="dictionary" name="dictionary" />
            <textarea name="dic" id="dic" rows="5" cols="50"></textarea><br />
            Stop processing if there's a positive match: <input type="checkbox" name="stop" value="yes"><br />
            <input type="submit" name="submit" value="Decipher"/>
            </form>
    </div>
    <div id="result">
    <?php
    $start = microtime(true);
    function checkHash($hash, $long)
    {
       return preg_match('/^[a-f0-9]{'.$long.'}$/', $hash);
    }
    if(isset($_POST['submit'])):
            $hash = htmlentities($_POST['hash']);
            $salt = htmlentities($_POST['salt']);
            $type = $_POST['type'];
            $usedic = $_POST['dictionary'];
            $dic = $_POST['dic'];
            $stop = $_POST['stop'];
            $counter = 0;
            if($type == 'md5'):
                    if(!checkHash($hash, 32)):
                            echo '<div class="border">The entered hash doesn\'t look like MD5</div>';
                            exit();
                    else:
                            $data = array(
                                            'pages' => array(
                                                                    0  => 'http://md5decryption.com/',
                                                                    1  => 'http://md5-decrypter.com/',
                                                                    2  => 'http://md5.rednoize.com/?q='.$hash,
                                                                    3  => 'http://md5.hashcracking.com/search.php?md5='.$hash,
                                                                    4  => 'http://www.md5rainbow.com/'.$hash,
                                                                    5  => 'http://md5crack.com/crackmd5.php',
                                                                    6  => 'http://md5pass.info/',
                                                                    7  => 'http://md5.unidadlocal.com/'.$hash,
                                                                    8  => 'http://www.hashhack.com/index.php',
                                                                    9  => 'http://www.md5this.com/crackit.php',
                                                                    10 => 'http://md5hack.com/md5_cracker.php',
                                                                    11 => 'http://www.md5.net/cracker.php',
                                                                    12 => 'http://crackstation.net/index.php'
                                            ),
                                            'parameters' => array(
                                                                    0  => 'hash='.$hash.'&submit=Decrypt It!',
                                                                    1  => 'data[Row][cripted]='.$hash,
                                                                    2  => null,
                                                                    3  => null,
                                                                    4  => null,
                                                                    5  => 'term='.$hash.'&submit=Crack that hash baby!',
                                                                    6  => 'hash='.$hash.'&get_pass=Get Pass',
                                                                    7  => null,
                                                                    8  => 'hash='.$hash.'&antispam=7',
                                                                    9  => 'h='.$hash.'&s=Crack it!',
                                                                    10 => 'dico=dicos/1.txt&hash='.$hash.'&ok= Crack ',
                                                                    11 => 'hash='.$hash,
                                                                    12 => 'hashes='.$hash.'&crack=Crack Hashes'
                                            ),
                                            'sustitution' => array(
                                                                    0  => "/Decrypted Text: <\/b>(.*)<\/font>/",
                                                                    1  => "/<b class=\"res\">(.*)<\/b>/",
                                                                    2  => "/<div id=\"result\" >(.*)<\/div>/",
                                                                    3  => "/Cleartext of ".$hash." is (.*)/",
                                                                    4  => "/(.*)<br\/><p style=\"font-size: 9pt; line-height: 48px;\">/",
                                                                    5  => "/Found: md5\(\"(.*)\"\) = ".$hash."/",
                                                                    6  => "/Password - <b>(.*)<\/b>/",
                                                                    7  => "/Se encontro <strong>\"(.*)\"<\/strong>  MD5:/",
                                                                    8  => "/<center>".$hash." : : <b><font color=green>(.*)<\/font><\/b>/",
                                                                    9  => "/The value of <b>".$hash."<\/b> resolves to -> <b>(.*)<\/b>/",
                                                                    10 => "/<h3>".$hash." <\/br><font color=white>Cracking Successful Password =<\/font><font color=red size=20> (.*)/",
                                                                    11 => "/<input type=\"text\" id=\"hash\" size=\"32\" value=\"(.*)\"\/> /",
                                                                    12 => "/<td>".$hash."<br \/><\/td><td>md5<\/td><td>(.*)<\/td>/"
                                            ),
                                            'security' => array(
                                                                    0  => null,
                                                                    1  => "<b class=\"res\">".$hash."</b>",
                                                                    2  => null,
                                                                    3  => null,
                                                                    4  => null,
                                                                    5  => null,
                                                                    6  => null,
                                                                    7  => null,
                                                                    8  => null,
                                                                    9  => null,
                                                                    10 => null,
                                                                    11 => null,
                                                                    12 => null
                                            )
                            );
                    endif;
            elseif($type == 'sha1'):
                    if(!checkHash($hash, 40)):
                            echo '<div class="border">The entered hash doesn\'t look like SHA1</div>';
                            exit(1);
                    else:
                            $data = array(
                                            'pages' => array(
                                                                    0  => 'http://sha1.unidadlocal.com/'.$hash
                                            ),
                                            'parameters' => array(
                                                                    0  => null,
                                                                    1  => 'datafromuser='.$hash
                                            ),
                                            'sustitution' => array(
                                                                    0  => "/Se encontro <strong>\"(.*)\"<\/strong>  SHA1:/"
                                            ),
                                            'security' => array(
                                                                    0  => null
                                            )
                            );
                    endif;
            /*
            passcracking.com isn't works anymore, so... is deprecated.
            elseif($type == 'mysql'):
                    if(!checkHash($hash, 16)):
                            echo '<div class="border">The entered hash doesn\'t look like MySQL</div>';
                            exit(1);
                    else:
                            $data = array(
                                                    'pages' => array(
                                                                            0  => 'http://passcracking.com/'
                                                    ),
                                                    'parameters' => array(
                                                                            0  => 'datafromuser='.$hash
                                                    ),
                                                    'sustitution' => array(
                                                                            0  => "/<td bgcolor=#FF0000>(.*)<\/td><td>/",
                                                    ),
                                                    'security' => array(
                                                                            0  => null
                                                    )
                                    );
                    endif;*/
            elseif($type == 'smf'):
                    if(!checkHash($hash, 40)):
                            echo '<div class="border">The entered hash doesn\'t look like SMF</div>';
                            exit(1);
                    endif;
            endif;
            $title = 'Cipher type: <font color="#00FF00">'.strtoupper($type).'</font><br />- - - - - - - - - - -<br />';
            if($usedic != 'yes'):
                    echo $title;
                    for($i = 0; $i<count($data['pages']); $i++):
                            $ch = curl_init();
                            curl_setopt($ch, CURLOPT_URL, $data['pages'][$i]);
                            if(!empty($data['parameters'][$i]))
                            {
                                    curl_setopt($ch, CURLOPT_POST, 1);
                                    curl_setopt($ch, CURLOPT_POSTFIELDS, $data['parameters'][$i]);
                            }
                            curl_setopt($ch, CURLOPT_AUTOREFERER, false);
                            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
                            curl_setopt($ch, CURLOPT_REFERER, $data['pages'][$i]);
                            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                            $return = curl_exec ($ch);
                            curl_close ($ch);
                            if(!empty($data['sustitution'][$i]))
                            {
                                    $test = preg_match($data['sustitution'][$i], str_replace($data['security'][$i], "", $return), $result);
                                    $result = $result[1];
                            }
                            $result = ($result == 'Entry not found.' or empty($result)) ? '' : $result;
                            if(!empty($result)):
                                    $counter++;
                                    $hash_dec = $result;
                                    echo 'Hash::['.$hash.']<br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Page::<font color="#00FF00">'.$data['pages'][$i].'</font><br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Status::<font color="#00FF00">Found</font><br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Result::<font color="#00FF00">'.$hash_dec.'</font><br />';
                                    if($stop == 'yes'):
                                            break;
                                    endif;
                            elseif($stop != 'yes'):
                                    echo 'Hash::['.$hash.']<br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Page::<font color="red">'.$data['pages'][$i].'</font><br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Status::<font color="red">Not Found</font><br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Result::<font color="red">none</font><br />';
                            endif;
                    endfor;
                    $min = ($stop == 'yes') ? '[Min] '.$counter.' of '.count($data['pages']): $counter.'/'.count($data['pages']);
                    if($counter >= 1):
                            echo '- - - - - - - - - - -<br />Positive matches: <font color="#00FF00">'.$min.'</font>';
                            echo '<br />Deciphered hash: <font color="#00FF00">'.$hash_dec.'</font>';
                    else:
                            echo '- - - - - - - - - - -<br />Positive matches: <font color="red">[None] '.$counter.'/'.count($data['pages']).'</font>';
                            echo '<br />Deciphered hash: <font color="red">Not Found</font>';
                    endif;
            else:
                    $palabra = explode("\r\n", $dic);
                    if((count($palabra) > $max) or (count($palabra) == 1)):
                            echo '<div class="border">Only allows <font color="red">1-'.$max.'</font> word per dictionary.</div>';
                            exit(1);
                    else:
                            echo $title;
                            for($i = 0; $i<count($palabra); $i++):
                                    if($type == 'md5' or $type == 'sha1'):
                                            $new_hash = ($type == 'md5') ? md5($palabra[$i]) : sha1($palabra[$i]);
                                    elseif($type == 'smf'):
                                            $new_hash = sha1($salt.$palabra[$i]);
                                            $add = $salt;
                                    endif;
                                    if(!empty($palabra[$i])):
                                            if($new_hash == $hash):
                                                    $counter++;
                                                    $hash_dec = htmlspecialchars($palabra[$i], ENT_QUOTES);
                                                    echo 'Hash::['.$hash.']<br />';
                                                    echo (!empty($salt)) ? '&nbsp;&nbsp;&nbsp;&nbsp;[+]Salt::<font color="#00FF00">'.$salt.'</font><br />' : '';
                                                    echo '&nbsp;&nbsp;&nbsp;&nbsp;[+]Word::<font color="#00FF00">'.$hash_dec.'</font><br />
                                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Status::<font color="#00FF00">Found</font><br />
                                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Result::<font color="#00FF00">'.$add.$hash_dec.'</font><br />';
                                                    if($stop == 'yes'):
                                                            break;
                                                    endif;
                                            elseif($stop != 'yes'):
                                                    echo 'Hash::['.$hash.']<br />';
                                                    echo (!empty($salt)) ? '&nbsp;&nbsp;&nbsp;&nbsp;[+]Salt::<font color="red">'.$salt.'</font><br />' : '';
                                                    echo '&nbsp;&nbsp;&nbsp;&nbsp;[+]Word::<font color="red">'.$palabra[$i].'</font><br />
                                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Status::<font color="red">Not Found</font><br />
                                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Result::<font color="red">none</font><br />';
                                            endif;
                                            $total++;
                                    endif;
                            endfor;
                            if($counter == 0):
                                    echo 'Hash::['.$hash.']<br />';
                                    echo (!empty($salt)) ? '&nbsp;&nbsp;&nbsp;&nbsp;[+]Salt::<font color="red">'.$salt.'</font><br />' : '';
                                    echo '&nbsp;&nbsp;&nbsp;&nbsp;[+]Word::<font color="red">'.$palabra[$i].'</font><br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Status::<font color="red">Not Found</font><br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;[+]Result::<font color="red">none</font><br />';
                            endif;
                            $min = ($stop == 'yes') ? '[Mínimo] '.$counter.' de '.count($palabra): $counter.'/'.count($palabra);
                            if($counter >= 1):
                                    echo '- - - - - - - - - - -<br />Positive matches: <font color="#00FF00">'.$min.'</font>';
                                    echo '<br />Deciphered hash: <font color="#00FF00">'.$add.$hash_dec.'</font>';
                            else:
                                    echo '- - - - - - - - - - -<br />Positive matches: <font color="red">'.$counter.'/'.count($palabra).'</font>';
                                    echo '<br />Deciphered hash: <font color="red">Not Found</font>';
                            endif;
                    endif;
            endif;
            $end = microtime(true); //Obtenemos tiempo final
            echo '<br />Execution time: <font color="#00FF00">'.str_replace('-', '', round($start - $end, 2)).' sec</font>';
    endif;
    ?>
    </div>
    </div>



    Nota: Es probable que tenga fallos o que alguno de los sitios no funcionen, por lo que no me hago responsable de los fallos en cuestión. Además, el script lo que hace es mandar petición a una lista de páginas que hacen todo el trabajo; éste script, sólo sirve de intermediario.
    Nota: El script es viejo por lo que se puede optimizar bastante.


    Saludos.
Cada vez que me das Karma me motivas

perdon por revivir el post, pero esto todavia funciona?
Pentest - Hacking & Security Services

Contact me: You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Sí, aunque creo que algunos sitios están caídos o tienen captcha; el día de mañana postearé un tuto respecto a ésto para que lo tomes de referencia, igual lo actualizaré bajo otro nombre.

Saludos,
Xt3mP.
Cada vez que me das Karma me motivas