Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
PHP/fgets
Hi I'm playing around with fgets so I made a quick md5 dictionary attack:
<h2>Hash:</h2>
<input type="text" name=hash>
<input type="submit" value="Crack Me!">
<?php
$check_file = file_exists('dict.txt');
if (! $check_file)
{
die("Error: No wordlist found!");
}
$md5hash = $_POST['hash'];
$open = fopen("dict.txt", "r");
while (! feof($open))
{
$dict = fgets($open);
$hashdict = md5($dict);
}
if ($md5hash == $hashdict)
{
echo "<br /> <br />The Password Is: " . $dict;
break;
}
else
{
echo "<br /> <br />Password Not Found";
}
fclose($open);
?>```
and dict.txt is:
```markup
asdfasdf
pass
sdfsdf
The code will work as long as 'pass' is the first word in dict.txt. Otherwise it will not find the password. I'm guessing the problem is with fgets because it is not getting each line of dict.txt? Can you guys help me out? Thanks