Created
April 13, 2018 18:56
-
-
Save madmo/7e7dc7ff99fddee7b7df60b36ad60f12 to your computer and use it in GitHub Desktop.
pass to keepass xc csv exporter
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 | |
# export passwords to external file | |
shopt -s nullglob globstar | |
prefix=${PASSWORD_STORE_DIR:-$HOME/.password-store} | |
for file in "$prefix"/**/*.gpg; do | |
file="${file/$prefix//}" | |
GROUP=$(dirname "$file" | sed 's#^//##') | |
TITLE=$(basename "$file" | sed 's/\.gpg$//') | |
TEXT=$(pass "${file%.*}") | |
USER=$(echo "$TEXT" | grep ^login: | sed 's/^login: //') | |
URL=$(echo "$TEXT" | grep ^url: | sed 's/^url: //') | |
PASS=$(echo "$TEXT" | head -n1) | |
echo "'${GROUP}';'${TITLE}';'${USER}';'${PASS}';'${URL}';'$(echo $TEXT | sed 's/\n/ /')'" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment