Advertisement
Guest User

Untitled

a guest
Nov 28th, 2010
824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.26 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3.  
  4. $db_host = "localhost"; //if your port is different then default, add a colon : and the port number (ex localhost:1337)
  5. $db_user = "user";
  6. $db_password = "pass";
  7. $db_name = "db";
  8. $db_table ="table";
  9. $table_id_field = "id"; //change this if the unique ID field is called something else. (ie Id, ID)
  10. $table_hash = "hash"; //change this if the hash field is called something else
  11. $table_plaintext = "dehashed"; //change this for where the plain text version of the password will be updated to
  12.  
  13. //dont change anything below here unless you know what you are doing
  14.  
  15. mysql_connect($db_host, $db_user, $db_password);
  16.  
  17. mysql_select_db($db_name) or die(mysql_error());
  18.  
  19. $query = "SELECT * FROM " . $db_table . " limit 1";
  20.      
  21. $result = mysql_query($query) or die(mysql_error());
  22.  
  23. function get_string_between($string, $start, $end){
  24.     $string = " ".$string;
  25.     $ini = strpos($string,$start);
  26.     if ($ini == 0) return "";
  27.     $ini += strlen($start);
  28.     $len = strpos($string,$end,$ini) - $ini;
  29.     return mysql_real_escape_string(substr($string,$ini,$len));
  30. }
  31.  
  32. function give_back($url, $post, $text){
  33.     $posted_vars = $post . "=" . $text;
  34.     $ch = curl_init();
  35.     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  36.     curl_setopt($ch, CURLOPT_REFERER, $url);
  37.     curl_setopt($ch, CURLOPT_URL,$url);
  38.     curl_setopt($ch, CURLOPT_POST, 1);
  39.     curl_setopt($ch, CURLOPT_POSTFIELDS, $posted_vars);
  40.     curl_exec($ch);
  41.     curl_close($ch);
  42.     unset($ch);
  43. }
  44.  
  45. function do_except($num, $plaintext){
  46.     if($num !=1){
  47.         give_back("http://md5-encryption.com/", "data[Row][clear]", $plaintext);       
  48.     }
  49.  
  50.     if($num !=2){
  51.         give_back("http://md5encryption.com/", "submit=Encrypt%20It!&word", $plaintext);
  52.     }
  53. }
  54. function fetch_md5($url, $post, $start, $end, $trim, $hash){
  55.     $posted_vars = $post . "=" . $hash;
  56.     $ch = curl_init();
  57.     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  58.     curl_setopt($ch, CURLOPT_REFERER, $url);
  59.     curl_setopt($ch, CURLOPT_URL,$url);
  60.     curl_setopt($ch, CURLOPT_POST, 1);
  61.     curl_setopt($ch, CURLOPT_POSTFIELDS, $posted_vars);
  62.     $fetched_page = curl_exec($ch);
  63.     curl_close($ch);
  64.     unset($ch);
  65.  
  66.     $password = get_string_between($fetched_page, $start, $end);
  67.  
  68.     if(isset($trim) && !empty($trim)){
  69.         $password = substr($password, $trim);
  70.     }
  71.  
  72.     return $password;
  73. }
  74.  
  75. function update_plaintext($table_name, $id_field, $row_id, $plaintext, $dehashed){ //table name, table id field, row id value, the table plaintext field, the dehashed password
  76.     $sql = "update $table_name set $plaintext = '$dehashed' where $id_field = '$row_id'";
  77.     mysql_query($sql);
  78. }
  79.  
  80. while($row = mysql_fetch_array($result)){
  81.  
  82.     $password1 = fetch_md5("http://md5-decrypter.com/", "data[Row][cripted]", "Decrypted text:</b>", "</b>", "21", $row[$table_hash]);
  83.  
  84.     if(!empty($password1)){
  85.         update_plaintext($db_table, $table_id_field, $row[$table_id_field], $table_plaintext, $password1);
  86.         if($giveback == "1"){
  87.             do_except("1", $password1);
  88.         }
  89.         continue;
  90.     }
  91.  
  92.     $password2 = fetch_md5("http://md5decryption.com/", "submit=Decrypt%20It!&hash", "Decrypted Text: </b>", "</font><br/>", "", $row[$table_hash]);
  93.  
  94.     if(!empty($password2)){
  95.         update_plaintext($db_table, $table_id_field, $row[$table_id_field], $table_plaintext, $password2);
  96.         if($giveback == "1"){
  97.             do_except("2", $password2);
  98.         }
  99.         continue;
  100.     }
  101.  
  102. }
  103. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement