cybercode

SHA1 & MD5 Hash Cracking Tool - Version 1.1b6

Jan 9th, 2012
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 7.39 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # SHA1 & MD5 Hash Cracking Tool - Version 1.1b6
  3. # Download: http://kalgecin.googlecode.com/files/crack.zip
  4. # Sources : http://www.darknet.org.uk/2009/07/crack-pl-sha1-md5-hash-cracking-tool/
  5. # Mirror : http://pastebin.com/fZnVLU94
  6.  
  7. use Digest::MD5 qw(md5_hex);
  8. use Digest::SHA1 qw(sha1_hex);
  9. use Term::ANSIColor qw(:constants);
  10. print "An md5/sha1  Digest cracker designed by KALGECIN\n";
  11. print "kalgecin\@gmail.com\n";
  12. my $type=$ARGV[2];
  13. my $hash=$ARGV[0];
  14. my $file=$ARGV[1];
  15. my $md5="md5";
  16. my $sha1="sha1";
  17. my $computedhash="";
  18. my $pass="";
  19. my $x;
  20. my $done = 0;
  21. my $timeg;
  22. my $timea;
  23. my $status;
  24. my $timediff;
  25. my $one; $two; $three; $four; $five; $six; $seven; $eight;
  26. my $a; $b; $c; $d; $e; $f; $g; $h;
  27. my $cnt2;
  28. my $bm1; $bm2;
  29. my $left;
  30. if($hash eq "" || $file eq ""){
  31.     print "Usage : $0 <hash|table> <password file>|bruteforce>  [md5|sha1]\n";
  32.     if($hash eq "benchmark"){
  33.     }
  34.     else{
  35.         print "Exit\n";
  36.         exit();
  37.     }
  38. }
  39. if(length($hash)==32){
  40.     $type="md5";
  41. }
  42. elsif(length($hash)==40){
  43.     $type="sha1";
  44. }
  45. elsif($hash eq "benchmark"){
  46.     $type="benchmark";
  47.     print "Benchmarking\n";
  48. }
  49. elsif($hash eq "table") {
  50.     if($type eq ""){
  51.         print "Usage : $0 table <password file|bruteforce> <md5|sha1>\n";
  52.         exit();
  53.     }
  54.     if($type eq "md5"){
  55.         print "Generating MD5 table\n";
  56.     }
  57.     elsif($type eq "sha1"){
  58.         print "Generating SHA1 table\n";
  59.     }
  60.     else{
  61.         print "Usage : $0 table <password file|bruteforce> <md5|sha1>\n";
  62.         exit();
  63.     }
  64.     print "Generating table\n";
  65. }
  66. else{
  67.     print "Invalid Hash\n";
  68.     exit();
  69. }
  70. $timeg = time;
  71. #print "Started at $timeg";
  72. if($type eq "benchmark"){
  73.     my $hash1 = "02c425157ecd32f259548b33402ff6d3"; #md5
  74.     my $hash2 = "cb990257247b592eaaed54b84b32d96b7904fd95"; #sha1
  75.     print "Started BenchMarking\n";
  76.     @letters=("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","1","2","3","4","5","6","7","8","9","0");
  77.     $cnt2 = @letters;
  78.     for($a=0;$a<$cnt2;$a++){
  79.         for($b=0;$b<$cnt2;$b++){
  80.             for($c=0;$c<$cnt2;$c++){
  81.                 for($d=0;$d<$cnt2;$d++){
  82.                     for($e=0;$e<$cnt2;$e++){
  83.                         for($f=0;$f<$cnt2;$f++){
  84.                             for($g=0;$g<$cnt2;$g++){
  85.                                 for($h=0;$h<$cnt2;$h++){
  86.                                     $passtotest=$one . $two . $three . $four . $five . $six . $seven . $eight;
  87.                                     $timea=time-$timeg;
  88.                                     if($timea!=0){
  89.                                         $status=$done/$timea;
  90.                                     }
  91.                                     else{
  92.                                         $status="Underfined";
  93.                                     }
  94.                                     if($bm1!=1){
  95.                                         $computedhash=md5_hex($passtotest);
  96.                                         if($computedhash eq $hash1){
  97.                                             printf "\nComputed md5 in $timea s (%.1f c/s)\n",$status;
  98.                                             $bm1=1;
  99.                                            
  100.                                         }
  101.                                     }
  102.                                     if($bm2!=1){
  103.                                         $computedhash=sha1_hex($passtotest);
  104.                                         if($computedhash eq $hash2){
  105.                                             printf "\nComputed sha1 in $timea s (%.1f c/s)\n",$status;
  106.                                             $bm2=1;
  107.                                         }
  108.                                     }
  109.                                     if($bm1==1 && $bm2==1){
  110.                                         exit();
  111.                                     }
  112.                                     $done++;
  113.                                     $eight=$letters[$h];
  114.                                 }
  115.                                 $seven=$letters[$g];
  116.                             }
  117.                             $six=$letters[$f];
  118.                         }
  119.                         $five=$letters[$e];
  120.                     }
  121.                     $four=$letters[$d];
  122.                 }
  123.                 $three=$letters[$c];
  124.             }
  125.             $two=$letters[$b];
  126.         }
  127.         $one=$letters[$a];
  128.     }
  129. }
  130.    
  131. if($file eq "bruteforce"){
  132.     #Uncomment the characterset that you would like to use. Make sure that there is only ONE uncommented characterset
  133.     #@letters=("!","@","#","\$","%","^","&","*","(",")","_","+","-","=","?",">","<",";",":","{","}","[","]","\\","|" ,"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","0","1","2","3","4","5","6","7","8","9");
  134.     @letters=("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","1","2","3","4","5","6","7","8","9","0");
  135.     #@letters=("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");
  136.     #@letters=("0","1","2","3","4","5","6","7","8","9");
  137.     $cnt2 = @letters;
  138.     print "$cnt2 characters found\n";
  139.     if($hash eq "table"){
  140.         $seven=$letters[$g];
  141.         $six=$letters[$f];
  142.         $five=$letters[$e];
  143.         $four=$letters[$d];
  144.         $three=$letters[$c];
  145.     }
  146.     for($a=0;$a<$cnt2;$a++){
  147.         for($b=0;$b<$cnt2;$b++){
  148.             for($c=0;$c<$cnt2;$c++){
  149.                 for($d=0;$d<$cnt2;$d++){
  150.                     for($e=0;$e<$cnt2;$e++){
  151.                         for($f=0;$f<$cnt2;$f++){
  152.                             for($g=0;$g<$cnt2;$g++){
  153.                                 for($h=0;$h<$cnt2;$h++){
  154.                                     $passtotest=$one . $two . $three . $four . $five . $six . $seven . $eight;
  155.                                     $timea=time-$timeg;
  156.                                     if($timea!=0){
  157.                                         $status=$done/$timea;
  158.                                     }
  159.                                     else{
  160.                                         $timea="Undefined";
  161.                                     }
  162.                                     if($timediff>1000){
  163.                                         $timediff=0;
  164.                                         printf "$passtotest -> $done Done -> $timea s (%.1f c/s)                 \r", $status;
  165.                                     }
  166.                                     if($timediff<=1000){
  167.                                         $timediff++;
  168.                                     }
  169.                                     if($type eq $md5)
  170.                                     {
  171.                                         $computedhash=md5_hex($passtotest);
  172.                                         if($hash eq "table"){
  173.                                             print "$computedhash : $passtotest\n";
  174.                                         }
  175.                                     }
  176.                                     elsif($type eq $sha1)
  177.                                     {
  178.                                         $computedhash=sha1_hex($passtotest);
  179.                                         if($hash eq "table"){
  180.                                             print "$computedhash : $passtotest\n";
  181.                                         }
  182.                                     }
  183.                                     if($computedhash eq $hash){
  184.                                         print RED, "$hash is $passtotest\n", RESET;
  185.                                         print "Time used : $timea s\n";
  186.                                         if($timea>0){
  187.                                             $status=$done/$timea;
  188.                                         }
  189.                                         else{
  190.                                             $status="Undefined";
  191.                                         }
  192.                                         printf "Computed $done in $timea s (%.1f c/s)\n",$status;
  193.                                         $done=0;
  194.                                         exit();
  195.                                     }
  196.                                     $done++;
  197.                                     $eight=$letters[$h];
  198.                                 }
  199.                                 $seven=$letters[$g];
  200.                             }
  201.                             $six=$letters[$f];
  202.                         }
  203.                         $five=$letters[$e];
  204.                     }
  205.                     $four=$letters[$d];
  206.                 }
  207.                 $three=$letters[$c];
  208.             }
  209.             $two=$letters[$b];
  210.         }
  211.         $one=$letters[$a];
  212.     }
  213. }
  214. else{
  215.     print "Preparing for cracking....\n";
  216.     open INPUT_FILE, $file;
  217.     @passwords=<INPUT_FILE>;
  218.     chomp(@passwords);
  219.     $cnt=@passwords;
  220.     print "Loaded $cnt passwords\nCracking $type\n";
  221.     for($x=0;$x<=$cnt;$x++){
  222.         if($timea>30){
  223.             exit();
  224.         }
  225.         $timea=time-$timeg;
  226.         if($timediff>1000){
  227.             $timediff=0;
  228.             $left=$cnt-$done;
  229.             print "$pass -> $done Done -> $timea s \t($left left)                                          \r";
  230.         }
  231.         if($timediff<=1000){
  232.             $timediff++;
  233.         }
  234.         $pass=@passwords[$x];
  235.         if($type eq $md5)
  236.         {
  237.             $computedhash=md5_hex($pass);
  238.             if($hash eq "table"){
  239.                 print "$computedhash : $pass\n";
  240.             }
  241.         }
  242.         elsif($type eq $sha1)
  243.         {
  244.             $computedhash=sha1_hex($pass);
  245.             if($hash eq "table"){
  246.                 print "$computedhash : $pass\n";
  247.             }
  248.         }
  249.         if($computedhash eq $hash){
  250.             print RED, "$hash is $pass\n", RESET;
  251.             print "Time used : $timea s\n";
  252.             if($timea!=0){
  253.                 $status=$done/$timea;
  254.             }
  255.             if($timea==0){
  256.                 $status="Undeffined";
  257.             }
  258.             printf "Read $done passwords in $timea s (%.1f c/s)\n",$status;
  259.             print "\nFinnished\n";
  260.             $done=0;
  261.             exit();
  262.         }
  263.         $done++;
  264.     }
  265.     if($timea!=0){
  266.         $status=$done/$timea;
  267.     }
  268.     if($timea==0){
  269.         $status="Undeffined";
  270.     }
  271.     printf "Read $done passwords in $timea (%.1f c/s)\n",$status;
  272.     print "\nFinnished\n";
  273. }
Add Comment
Please, Sign In to add comment