Advertisement
Guest User

Untitled

a guest
May 6th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.66 KB | None | 0 0
  1. <style>
  2. body {
  3.     font-family: monospace;
  4. }
  5. </style>
  6.  
  7. <?php
  8.    $mtime = microtime();
  9.    $mtime = explode(" ",$mtime);
  10.    $mtime = $mtime[1] + $mtime[0];
  11.    $starttime = $mtime;
  12.  
  13.  
  14.     if ( $argv[1] != NULL ) {
  15.         $num = $argv[1];
  16.     } else {
  17.         if ( $_GET['amt'] != NULL ) {
  18.             $num = $_GET['amt'];
  19.         } else {
  20.             $num = 1000;
  21.         }
  22.     }
  23.  
  24.     if ( date("G") < 9 ) {
  25.         if ( $num > 500 ) {
  26.             $num = 500;
  27.         }
  28.     }
  29.  
  30.     // initial variables
  31.     $username = "";
  32.     $password = "";
  33.     $database = "";
  34.     $hash_engine = array('md2','md4','md5','sha1','sha256','sha384','sha512');
  35.  
  36.     // conenct to the mysql server
  37.     $connect = mysql_connect( localhost, $username, $password );
  38.     @ mysql_select_db( $database );
  39.  
  40. function hstr($input, $method) {
  41.     if ( $method == "encode" ) {
  42.         $s = str_split($input);
  43.         for ($y=0; $y<sizeof($s); $y ++) {
  44.             $end = $end . str_pad(dechex(ord($s[$y])), 2, "0", STR_PAD_LEFT);
  45.         }
  46.         return $end;
  47.     }
  48.     if ( $method == "decode" ) {
  49.         for ($y=0; $y<strlen($input)/2; $y ++) {
  50.             $end = $end . chr(hexdec( substr($input, $y*2, 2) ));
  51.         }
  52.         return $end;
  53.     }
  54. }
  55.  
  56. $result = mysql_query( "SELECT * FROM info" );
  57. $row = mysql_fetch_array( $result );
  58. $start = $row['last_gen'];
  59. echo $start;
  60.  
  61. for ($i=1; $i<strlen($start)/2+1; $i++) {
  62.     $myarray[$i] = hexdec(substr($start, strlen($start)-$i*2, 2));
  63. }
  64.  
  65. for ( $i=0; $i<$num; $i++ ) {
  66.     $myarray[1] += 1;
  67.     for ($k=0; $k<sizeof($myarray)+1; $k++) {
  68.         if ( $myarray[$k] > 255 ) {
  69.             $myarray[$k] = 0;
  70.             $myarray[$k+1] += 1;
  71.         }
  72.     }
  73.  
  74.     $final = "";
  75.     for ($j=0; $j<sizeof($myarray); $j++) {
  76.         $myarray2[$j] = dechex($myarray[sizeof($myarray)-$j]);
  77.         $final = $final . str_pad($myarray2[$j], 2, "0", STR_PAD_LEFT);
  78.     }
  79.  
  80. // begin
  81.     $s2 = hstr($final, "decode");
  82.  
  83.     $result = "SELECT * FROM md5 WHERE plain_text = '$final'";
  84.     mysql_real_escape_string( $result );
  85.     $result = mysql_query( $result );
  86.     $row = mysql_fetch_array( $result );
  87.  
  88.     if ($row['plain_text'] == NULL) {
  89.         mysql_query( "UPDATE info SET hashcount = hashcount+1" );
  90.         $add_percent = true;
  91.     }
  92.     for ( $l = 0; $l < sizeof($hash_engine); $l++ ) {
  93.         $hash = hash($hash_engine[$l], $s2);
  94.         $query = "INSERT INTO $hash_engine[$l] (hash, plain_text, timestamp) VALUES ('$hash', '$final' , now() )";
  95.         mysql_real_escape_string( $query );
  96.         mysql_query( $query );
  97.         if ( $add_percent == true ) {
  98.             $mesize = strlen($final) / 2;
  99.             // update list stats
  100.             $result = mysql_query( "SELECT * FROM stats WHERE length = '$mesize'" );
  101.             $row = mysql_fetch_array( $result );
  102.             $row[$hash_engine[$l]] = $row[$hash_engine[$l]]+1;
  103.             mysql_query( "REPLACE INTO stats (length, md2, md4, md5, sha1, sha256, sha384, sha512) VALUES ('$mesize', '$row[md2]', '$row[md4]','$row[md5]','$row[sha1]','$row[sha256]','$row[sha384]','$row[sha512]') " ) or die('a');
  104.         }
  105.     }
  106. // end
  107.     $result = mysql_query("SELECT * FROM info");
  108.     $row = mysql_fetch_array( $result );
  109.     mysql_query("REPLACE INTO info (hashcount, available, searched, timestamp, last_gen) VALUES ('$row[hashcount]', '$row[available]', '$row[searched]', '$row[timestamp]', '$final')");
  110.  
  111.     $milestones = array('100', '979060', '1000000', '2500000', '5000000', '10000000', '25000000', '50000000', '100000000');
  112.     if ($j = array_search($row['hashcount'], $milestones)) {
  113.         mysql_query( "INSERT INTO milestones (timestamp, count) VALUES (now(), '$row[hashcount]')" );
  114. print("lol works\n");
  115.     }
  116.  
  117.     usleep(100000);
  118.  
  119.    $mtime = microtime();
  120.    $mtime = explode(" ",$mtime);
  121.    $mtime = $mtime[1] + $mtime[0];
  122.    $endtime = $mtime;
  123.    $totaltime = ($endtime - $starttime);
  124.    if ($totaltime >= 110) {
  125.     break;
  126.     mysql_close( $connect );
  127.    }
  128. }
  129. print("\nGenerated $i hashes in $totaltime seconds\n");
  130. mysql_close( $connect );
  131. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement