Created
August 1, 2021 20:45
-
-
Save hehu80/05b5f46330b4959a9b6724b35076c723 to your computer and use it in GitHub Desktop.
get KeePass secret with shell script
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/bash | |
KEY_FILE="/path/of/your/keepass.file" | |
KEY_NAME="name of the key entry" | |
KEEPASS_ENTRY=$(keepassxc-cli show -s "${KEY_FILE}" "${KEY_NAME}") | |
PASSWORD=$(echo -n "${KEEPASS_ENTRY}" | grep "Password" | grep -Po "Password: \K.*") | |
USERNAME=$(echo -n "${KEEPASS_ENTRY}" | grep "UserName" | grep -Po "UserName: \K.*") | |
printf "User: %s, Password: %s\n" "${USERNAME}" "${PASSWORD}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment