Page 1 of 1

Comparing string vs. dictionairy

Posted: Wed Dec 02, 2009 8:20 am
by Marinusjvv
Hi.

I'd like to compare a string to be used for a password against a dictionary. Any idea on how to do this?

Thanks

Re: Comparing string vs. dictionairy

Posted: Wed Dec 02, 2009 9:39 am
by AlanG
Marinusjvv wrote:Hi.

I'd like to compare a string to be used for a password against a dictionary. Any idea on how to do this?

Thanks
Ah ethical cracking I hope. :) You will need a dictionary file, the code is pretty simplistic.

Code: Select all

 
<?php
$words = file('/path/to/file/' . $dictionaryFile);
 
if(in_array($words, $passGuess)) {
    echo 'Password is :' . $passGuess;
}
else {
    echo 'Password is not in the dictionary file.';
}
?>
 
You will also have to account for case sensitivity. :)

Re: Comparing string vs. dictionairy

Posted: Wed Dec 02, 2009 10:29 am
by Marinusjvv
Thanks..

Yes, it's to ensure that users do not use normal words as a password. :)
Any idea where i can download a file to use as a dictionary? i've looked, but can't find..