Last active
January 10, 2017 17:30
-
-
Save mkroman/73f760fa29c532abbc6d760de11cda5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
password_file=$1 | |
container_file=$2 | |
if [ $# -ne 2 ]; then | |
echo "Usage: $0 <password_file> <container_file>" | |
exit 1 | |
fi | |
if [ ! -e "${password_file}" ]; then | |
echo "The password file \`${password_file}' does not exist" | |
exit 1 | |
fi | |
if [ ! -e "${container_file}" ]; then | |
echo "The container file \`${container_file}' does not exist" | |
exit 1 | |
fi | |
_num_pws=`wc -l "${password_file}" | cut -f1 -d' '` | |
echo "Trying to mount the container with ${_num_pws} different passwords." | |
while read line; do | |
echo -n "." | |
echo "${line}" | veracrypt --text --stdin --non-interactive --mount "${container_file}" /media/veracrypt1 >/dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
echo | |
echo "Container was successfully mounted!" | |
echo "Password: ${line}" | |
break | |
fi | |
done < ${password_file} | |
echo | |
echo "Exiting." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment