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.

WTF?!?!?!


ghost's Avatar
0 0

ok I am trying to make amd5 decryptor… here is the code

<?php

$hash=$_POST['crack2'];
$type=$_POST['hash'];

echo ("hash - ".$hash."<br>" );

$fh = fopen("sdict.txt", "r" );
while(!feof($fh)) {
	$word = fgets($fh);
	echo ("trying - ".$word."<br>" ) ;

	if ( md5($word) == $enc ) {
		echo "$word is the password!";
		break;
	}
}

echo "end of dict";

however I am getting dodgy hashes, eg 1234 gets hashed into - ff0eb2864feb22354747f8c85d42ccb5 when it should be - 81dc9bdb52d04dc20036dbd8313ed055

WTF is going on?!? it's not a server problem, I have tested it in various places, I am just stumped!…

any help please?


Mr_Cheese's Avatar
0 1

hmm well i've had probems with similar scripts where it only runs it on every other line.

i havnt found a way to stop this though. but it might be your problem. check the word beloe and above 1234 and see if that word is being hashed instead.


ghost's Avatar
0 0

no cos I echo every word and the corrosponding hash!


ghost's Avatar
0 0

OK, I haven't executed this script at all, but just by looking at it, why do you have the variable $enc? It should be $hash.

Plus, don't echo the word every time. It'll extend the time it takes to crack a hash considerably.

Oh, also that $type variable doesn't seem to be doing much…


ghost's Avatar
0 0

$enc - sorry my bad edited echoing the word everytime for testing perposes, good job I did otherwise I would have been even more clueless.

and $type is used in my script eg.

if ( $type($word) == $enc ) {
		echo "$word is the password!";
		break;
	}

so I can do sha1, md5 and crypt sent from another form


ghost's Avatar
0 0

Zeyphier wrote: $enc - sorry my bad edited echoing the word everytime for testing perposes, good job I did otherwise I would have been even more clueless.

and $type is used in my script eg.

if ( $type($word) == $enc ) {
		echo "$word is the password!";
		break;
	}

so I can do sha1, md5 and crypt sent from another form

OK, that should be your problem. Variables can't be used in the way you've just used $type.


ghost's Avatar
0 0

ok so here is the revised code!…

<?php

$hash="81dc9bdb52d04dc20036dbd8313ed055";
// md5 of 1234

echo ("hash - ".$hash."<br>" );

$fh = fopen("sdict.txt", "r" );
while(!feof($fh)) {
$word = fgets($fh);
echo ("trying - ".$word."<br>" ) ;
echo ("trying - ".md5($word)."<br>" ) ;

if ( md5($word) == $hash ) {
echo "$word is the password!";
break;
}
}

echo "end of dict";

?>

I am still getting stupid md5's and here is the contents of the dictionary (well the begining part)

!@*$%
!@*$%^
!@*$%^&
!@*$%^&*
*
0
0racl3
0racl38
0racl38i
0racl39
0racl39i
0racle
0racle10
0racle10i
0racle8
0racle8i
0racle9
0racle9i
1
1022
10sne1
111111
121212
1225
123
123123
1234
12345

hence why I was testing 1234… any sugestions, I will try them all

OMFG, I must be such a tard, I bet it is right in my face!… ARGGGHHH (just had to let that out!)


ghost's Avatar
0 0

update I have edited the code so it uses $type and it works, alough I still get the wrong hash! (its the same, but wrong still)


n3w7yp3's Avatar
Member
0 0

I had a similar problem when I first attempted to code an MD5 cracker in Perl. The answer (in my case) was quite simple. The files in the dictionary actually end (from the programs point of view), with &*92;n. So the dictionary actually looks like:

apple&*92;n
bear&*92;n
test&*92;n

etc. My mistake was not removing the &*92;n. In Perl this is accomplished via the chomp() or chop(0 functions. Not sure about PHP, but it may be the same.

Actually, now that I think about it, this may not even be your problem. I'm not sure if PHP takes it as word&*92;n. In any case, try it out and see what happens.

GL. ;)

[edit] The site automatically changes the backslash character to &*92; . Maybe this is something that the admins need to be fixing..?[/edit]