Follow us on Twitter!
One mans freedom fighter, another's terrorist.
Saturday, April 19, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 32
Guests Online: 30
Members Online: 2

Registered Members: 82838
Newest Member: w1zarrd
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

PHP/fgets


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 26-09-08 21:55
Hi I'm playing around with fgets so I made a quick md5 dictionary attack:
Code
<form action="" method="post">
<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:
Code

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
Author

RE: PHP/fgets

Mr_Cheese




Posts: 2468
Location: Brighton, UK
Joined: 30.11.04
Rank:
Uber Elite
Posted on 27-09-08 00:38
your IF statement is outside your while loop.

it needs to be inside. otherwise it will only compare the last line in the dictionary.
http://www.hellboundhackers.org/
Author

RE: PHP/fgets

spyware
Member



Posts: 4192
Location: The Netherlands
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 27-09-08 01:10
Wait, like three seconds ago someone replied here with a post full of PHP code, right? Where did that go?



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
“Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?” - Ebert
[/s
http://bitsofspy.net
Author

RE: PHP/fgets


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 29-09-08 23:57
Thanks Smile
Author

RE: PHP/fgets


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 30-09-08 01:33
... Welcome.