In this tutorial I would be teaching you how to make a md5 dictionary cracker. The code would be explained as clearly as possible.

Whats the difference between this and Cain or John the Ripper?
The best thing about a PHP dictionary cracker is that it is 95% faster than Cain or John the Ripper. The speed depends on your server.

Where can I get a dictionary? And where should I put it?
Well, you can use John The Ripper's one or my favourite Cain's one, You should make a folder name it "dictionaries".

Can I use more than a dictionary at a time?
Yes, but the code in this tutorial is way too simple and its not included.

I made this MD5 Hash Cracker but I don't have any hashes to crack?
To make a md5 hash crack all you need it a 3 line script
<?php
echo md5("Word to crack here");
?>
I'll post a complete script at the end of this tutorial

Lets go to the PHP script first

<?PHP
//In the line above you are opening a php script

  if(isset($_POST['crack'])){
//It checks if the submit button was pressed

   $handle = fopen("dictionaries/".$_POST['dictionary'], "r");
//It loads the dictionary

        if($handle){
//It checks if the loading of the dictionary is true

         while (!feof($handle)) {
//Tests for end-of-file on a file pointer

              $buffer = fgets($handle);
//Gets line by line

              $buffer = trim($buffer, "
   ");
//This removes the paragraph so there is no extra characters
p7
            

	
	$word_to_crack = $_POST['hash'];
//This assigns the input to the varialbe $word_to_crack

                if(md5($buffer) == $word_to_crack){
//This encrypts the the line from the dictionary and it checks it with the input of the user
?>
<script>alert("We have found a match for <? echo $word_to_crack; ?>, that is <? echo $buffer; ?>");</script>
<?
//I think you know what the line above does

                }
//Closes the Checking of the input and the line encrypted

        }
//Closes the line while (!feof($handle))

fclose($handle);
//Closes the dictionary loaded if it was loaded

    } else {
        echo "Could not load dictionary";
    }
//This checks if the dictionary wasn't loaded and it prints on the screen that the dictionary could not be loaded

}
//Closes the checking if the user pressed the button
//Line below closes this php script
?>

Ok I understand the code now but I have no clue how to use it.
This is simple:
<form action='' method='POST'>
<!-- This opens a form so the data can be submitted -->

Dictionary: <SELECT name='dictionary'><OPTION value='dictionary.txt'>Dictionary One</OPTION></SELECT>
<!-- This makes a dropdown menu, so the user can select what dictionary to use, you must type the dictionary name(s) or make a script to do it -->

Hash to crack: <input type='text' name='hash' value=''>
<!-- This makes an input box, so the user can put their hash -->

<input type='submit' name='crack' value='Start Cracking'>
<!-- This makes a button so the user can click on it to start cracking-->

</form>
<!-- Closes the form -->


Here is one script alitle more complex but easier to use

<?
  if(isset($_POST['crack'])){
   $handle = fopen("dictionaries/".$_POST['dictionary'], "r");
        if($handle){
         while (!feof($handle)) {
              $buffer = fgets($handle);
              $buffer = trim($buffer, "
   ");
            $word_to_crack = $_POST['hash'];
                if(md5($buffer) == $word_to_crack){
?>
<script>alert("We have found a match for <? echo $word_to_crack; ?>, that is <? echo $buffer; ?>");</script>
<?
echo "We have found a match for ".$word_to_crack.", that is ".$buffer;
                }
        }
fclose($handle);
    } else {
        echo "Could not load dictionary";
    }
    exit;
} else {
?>
<?php
if(isset($_POST['hash_word'])){
  echo "The hash for the word ".$_POST['word_to_hash']." is ".md5($_POST['word_to_hash']). "<br>";
exit;
} else {
  echo "<form action='' method='POST'>Word to hash: <input type='text' name='word_to_hash'><br><input type='submit' name='hash_word' value='Hash!'><br><hr><br>";
}
?>
<form action='' method='POST'>
<!-- This opens a form so the data can be submitted -->

Dictionary:
<SELECT name='dictionary'>
<?php
 if ($handle = opendir('dictionaries/')) {
   // Opens the directory "dictionaries"
   while (false !== ($file = readdir($handle))) {
     //Checks if there is files
       if ($file != "." && $file != "..") {
         //This eliminates . and the .. so they are not displayed

           echo "<OPTION value='".$file."'>".$file."</OPTION>\n";
           //Creates the output
       }
       //Closes the elimination of the . and ..
   
p13



}
   //Closes the checking of files
   closedir($handle);
   //Closes the opening of the dir
}
//Closes the opening of the dir
?>

</SELECT><br>
<!-- This makes a dropdown menu  -->

Hash to crack: <input type='text' name='hash' value=''><br>
<!-- This makes an input box, so the user can put their hash -->

<input type='submit' name='crack' value='Start Cracking'>
<!-- This makes a button so the user can click on it to start cracking-->

</form>
<!-- Closes the form -->
<?php
}
?>

GrindorDie
