Skip to content

Instantly share code, notes, and snippets.

@konstruktoid
Created May 25, 2022 10:45
Show Gist options
  • Save konstruktoid/0639dc55e0ca4409c5c1e9b4033b8da5 to your computer and use it in GitHub Desktop.
Save konstruktoid/0639dc55e0ca4409c5c1e9b4033b8da5 to your computer and use it in GitHub Desktop.
Brute force a VeraCrypt container when algorithms aren't known
#!/bin/bash
# So sorry it had to come to this, this is slow.
# Note that pim and keyfiles etc is static and needs to be modified if used.
# veracrypt --text --dismount --slot 1
set -eu -o pipefail
CONTAINER=""
MOUNTDIR=""
WORDLIST=""
grep -v '^$' "${WORDLIST}" | while read -r PASSWORD; do
echo "Trying ${PASSWORD}"
if echo -n "${PASSWORD}" | veracrypt --text --stdin --mount "${CONTAINER}" "${MOUNTDIR}" --pim 0 --keyfiles "" --protect-hidden no --slot 1 --verbose --non-interactive 2>/dev/null; then
veracrypt --text --list | grep "${CONTAINER}"
echo
echo "RESULT: ${PASSWORD}"
echo
exit 0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment