0z3ro

hashcat cracked passwords, change the decrypted hashes user

Jul 20th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <pre>
  2. <?
  3. set_time_limit(0);
  4. /// this code made for hashcat cracked passwords, change the decrypted hashes user:hash to -> user:pass
  5. // coded by z3ro
  6.  
  7.  
  8. $toreplace   ="www.victem.com_found10.txt";
  9. $fromorginal ="www.victem.com_hashes.txt";
  10. $replaced_clean = hash_by_line_to_replace($toreplace , $fromorginal);
  11.  
  12.  
  13.  
  14. function hash_by_line_to_replace($toreplace , $fromorginal)
  15. {
  16.     // geting the decoded hash value and spilt the hash and its value to array
  17.     $fh = fopen($toreplace, "r");
  18.     while ($row = fgets($fh))
  19.     {
  20.         $hash_data_row = trim($row);
  21.         $password = trim(array_pop(explode(':', $hash_data_row)));
  22.         $hash = trim(substr($hash_data_row, 0, strrpos( $hash_data_row, ':')));
  23.  
  24.         // geting from the orginal hash file the username and replace the hash with its value
  25.         $content = fopen($fromorginal, "r");
  26.         while ($row = fgets($content))
  27.         {
  28.             $userdata = explode(" ", $row);
  29.             if(trim($userdata[1]) == trim($hash))
  30.             {
  31.                    
  32.                 //echo "userdata 1 == hash   ".  $userdata[1] ."\n";
  33.                 //echo "userdata 0  == username   " .  $userdata[0] ."\n";
  34.                 //echo "string_to_replace == hash   ".  $hash ."\n";
  35.                 $user_login_info = $userdata[0] .':'. $password."\n";
  36.                 $replaced_clean = file_put_contents('clean_decoded_'.$fromorginal, $user_login_info, FILE_APPEND);
  37.                 if($replaced_clean)
  38.                 {
  39.                     echo 'insert into clean_decoded_'.$fromorginal.' values '. $user_login_info;
  40.                 }
  41.                
  42.             }
  43.         }
  44.         fclose($content);  
  45.     }
  46.     fclose($fh);
  47. }
  48.  
  49. ?>
Add Comment
Please, Sign In to add comment