Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- /*
- Version 1.0
- Coder Angel Cantu Jauregui
- Date Sep 3, 2018
- Mail angel.cantu@sie-group.net
- Github URL
- This tool is only for studing propuse, so if you made a bad use for this program is your reponsability.
- The limit for cracking password is between 1 and 8 letters, one hash for file, be careful and good luck ;)
- */
- error_reporting(0);
- function initzero($a, $b)
- {
- $r=array();
- for( $i=0; $i<$a; $i++ )
- $r[$i]= $b;
- return $r;
- }
- function arr2text($a)
- {
- $r='';
- foreach( $a as $key )
- $r .= $key;
- # echo "\n\nHere... [". $r. "] [". sha1($r). "]\n\n";
- return $r;
- }
- function crackit($hash)
- {
- $bruteforcing=array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' );
- $a= initzero(7, 0);
- $c= initzero(7, 0);
- $cad= $hash;
- $pwd= initzero(7, "");
- for( $a[0]=N, $c[0]=0; $c[0]<=count($bruteforcing); $c[0]++ )
- {
- for( $a[1]=$a[0]-1, $c[1]=0; $c[1]<=count($bruteforcing); $c[1]++ )
- {
- for( $a[2]=$a[1]-1, $c[2]=0; $c[2]<=count($bruteforcing); $c[2]++ )
- {
- for( $a[3]=$a[2]-1, $c[3]=0; $c[3]<=count($bruteforcing); $c[3]++ )
- {
- for( $a[4]=$a[3]-1, $c[4]=0; $c[4]<=count($bruteforcing); $c[4]++ )
- {
- for( $a[5]=$a[4]-1, $c[5]=0; $c[5]<=count($bruteforcing); $c[5]++ )
- {
- for( $a[6]=$a[5]-1, $c[6]=0; $c[6]<=count($bruteforcing); $c[6]++ )
- {
- for( $a[7]=$a[6]-1, $c[7]=0; $c[7]<=count($bruteforcing); $c[7]++ )
- {
- if( !strcmp($cad, sha1(arr2text($pwd)) ) )
- {
- echo "\n\n\t*****************************************";
- echo "\n\t*\tPassword Reventado es: ". arr2text($pwd). "\t*\n";
- echo "\t*****************************************\n\n";
- return arr2text($pwd);
- }
- $pwd[$a[7]]= $bruteforcing[$c[7]];
- }
- $pwd[$a[6]]=$bruteforcing[$c[6]];
- }
- $pwd[$a[5]]=$bruteforcing[$c[5]];
- # descomentame para tener "verbose"
- # echo "\nTesting: ". arr2text($pwd);
- }
- $pwd[$a[4]]=$bruteforcing[$c[4]];
- }
- $pwd[$a[3]]=$bruteforcing[$c[3]];
- }
- $pwd[$a[2]]=$bruteforcing[$c[2]];
- }
- $pwd[$a[1]]=$bruteforcing[$c[1]];
- }
- $pwd[$a[0]]=$bruteforcing[$c[0]];
- }
- }
- echo "Cracking SHA1\n**********************\n\n";
- if( $argc!=2 )
- echo "\n[ERROR] You need the full url from the file..";
- else
- {
- if( !file_exists($argv[1]) )
- echo "\n[ERROR] The file is not found..";
- else
- {
- echo "\nOpening file..";
- if( ($fp=fopen($argv[1], "r"))==FALSE ) # open stream
- echo "\t[FAILED]";
- else
- {
- echo "\t[DONE]";
- $buf= fgets($fp, (10*1024) ); # 10MB stream read
- $buf= substr( $buf, 0, -1);
- echo "\nHash Found: ". $buf. "\t[DONE]";
- $r=0; # init 0 response
- if( !($r=crackit($buf)) ) # cracking hash
- echo "\nCracking Hash\t[FAILED]";
- else
- echo "\nCracked, the password is: ". $r;
- fclose($fp); # close stream
- unset($r);
- }
- unset($fp);
- }
- }
- /*
- $t= "hello";
- echo "\nTesting:\n". $t. " --> ". sha1($t);
- */
- echo "\n\nGood bye...\n";
- exit();
- ?>
Add Comment
Please, Sign In to add comment