Last active
January 30, 2022 18:14
-
-
Save nachtmaar/9e1758e988d4fa25be707a68aa1726f1 to your computer and use it in GitHub Desktop.
I lost a password in my Keypass database and was looking for a way to search the lost password in all my backups easily and fast
This file contains hidden or 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
#!/usr/bin/env bash | |
echo -n "please enter the password for the keypass database:" | |
read -rs pw | |
echo | |
KEYPASS_KEY="$1" | |
SEARCH_PATTERN="$2" | |
echo "performing search in the following keypass databases:" | |
for i in "${@:3}"; do | |
echo "$i" | |
done | |
echo | |
echo "starting search ..." | |
for i in "${@:3}"; do | |
echo "searching in $i, output:" | |
keepassxc-cli ls -q -R -k "$KEYPASS_KEY" "$i" <<< "$pw" | grep -i "$SEARCH_PATTERN" | |
# keepassxc-cli locate -q "$i" $SEARCH_PATTERN -k "$KEYPASS_KEY" <<< "$pw" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used the script to search in a Keypass database that uses a keyfile and a password. If you don't have a keyfile, you need to slightly modify the script.
How I used it: