Making this password search more intelligent

In a homework, there is an exercise in which I have a script that is used to search for a password.

One of the questions is if is possible to make it "more intelligent", and I'm stuck on it.

#!/bin/bash

space1="a b c d e f g h i j k l m n o p q r s t u v w x y z"

if [  $# -le 1 ] then echo "Ussage: "$0 SALT PASSWORD_CODED
exit
fi

for i in $space1 do for j in$space1
do
for k in $space1 do variable=$(openssl passwd -crypt -salt "$1" "$i$j$k")
if [ "$variable" =$2 ]
then
echo password found: $i$j$k exit fi done done done  If it is possible, I prefer only a clue to help me to discover the answer correct, not the answer itself. I promise to post the result when I get the answer for myself. - +1 for request only for clue – Sunny Oct 7 '11 at 16:17 As suggested, you could use common words first or a dictionary, but brute force is brute force. In this case it's only 3 lower case characters, so it should take no time at all. I don't know if there is any other way to make the algorithm more intelligent. – Matt Oct 9 '11 at 8:16 What does "more intelligent" mean? – palacsint Nov 6 '11 at 21:57 4 Answers There's no real way to speed up the brute-force enumeration of all possible 3-letter passwords. Perhaps you could use the dictionary. There's a finite list of 3-letter English words. They may be slightly more common. Also, if you google for "most common passwords", some kind of 3-letter version of that list could be tried before anything else. - Look at the man page for openssl http://www.openssl.org/docs/apps/openssl.html It is the command being executed here: $(openssl passwd -crypt -salt "$1" "$i$j$k")


Another Clue below.
Only roll your curser over it if you need the extra help.

Do you need to pass the passwords one at a time.

Still have not worked it out!

-

The best way to do

space1="a b c d e f g h i j k l m n o p q r s t u v w x y z"
for i in $space1; do for j in$space1; do
for k in $space1; do echo$i$j$k
done
done
done


in bash is probably :

for i in {a..z}{a..z}{a..z}; do echo \$i; done


Then, depending on what your homeworks says, it might or might not be what you are looking for.

-

If you want to support passwords with 4-5-6-n characters without more loops you could write a bijective function which maps integers to strings.

Maybe you want to check the homepage of the John the Ripper password cracker. It has downloadable word lists and maybe you can find some information about how John generates the passwords. Also check the Methods of attack chapter in Rob Shimonski's Hacking techniques article.

-