Reputation: 71
I was able to fix the error not being able to use *
as part of the LIST
. However i was not able to compare and get the desired output of the password.
#!/bin/bash
LIST=(W 2 v '*' %)
encr="Cd9AjUI4nGglIcP3MByrZUnu.hHBJc7.eR0o/v0A1gu0/6ztFfBxeJgKTzpgoCLptJS2NnliZLZjO40LUseED/"
salt="8899Uidd"
for i in "${LIST[@]}"
do
for j in "${LIST[@]}"
do
for k in "${LIST[@]}"
do
for l in "${LIST[@]}"
do
for a in "${LIST[@]}"
do
echo -n "$i$j$k$l$a "
test="mkpasswd -m SHA-512 $i$j$k$l$a -s $salt | cut -d"$" -f4"
if [ "$test" == "$encr" ] ; then
echo " Password is: $i$j$k$l$a"
exit
fi
done
done
done
done
done
#error comparing
The Output should be Password is: W2v*%
, but it came out as %%%%%
Upvotes: 1
Views: 147
Reputation: 71
With a little bit of tweaking here and there. Here we have a fixed one :D
Hope its working for you guys as well.
#!/bin/bash
LIST1=(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)
LIST2=(0 1 2 3 4 5 6 7 8 9)
LIST3=(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)
LIST4=("~" "@" "#" "$" "%" "^" "*" "_" "+" "-" "=" "{" "}" "[" "]" "?" ";" ":")
LIST5=("~" "@" "#" "$" "%" "^" "*" "_" "+" "-" "=" "{" "}" "[" "]" "?" ";" ":")
encr="Cd9AjUI4nGglIcP3MByrZUnu.hHBJc7.eR0o/v0A1gu0/6ztFfBxeJgKTzpgoCLptJS2NnliZLZjO40LUseED/"
salt="8899Uidd"
for i in "${LIST1[@]}"
do
for j in "${LIST2[@]}"
do
for k in "${LIST3[@]}"
do
for l in "${LIST4[@]}"
do
for a in "${LIST5[@]}"
do
echo -n "$i$j$k$l$a"
test="$(mkpasswd -m SHA-512 "$i$j$k$l$a" -s $salt | cut -d"$" -f4)"
if [ "$test" == "$encr" ] ; then
echo " Password is: $i$j$k$l$a"
exit
fi
done
done
done
done
done
P.S: I overdid with the list. You can combine the list into one.
Upvotes: 1