Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Keepass to Pass database converter
- # ----------------------------------
- #
- # Convert Keepass .csv export to valid gpg
- # files in the .password-store directory
- #
- # Usage:
- # ./keepasstopass.sh -i [mydatabase.csv] -u [gpg_user]
- #
- OPTS=`getopt -o ui: --long user,input-file: -n 'parse-options' -- "$@"`
- if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
- while true; do
- case "$1" in
- -u | --user ) USER="$2"; shift ; shift ;;
- -i | --input-file ) INPUT_FILE="$2"; shift; shift ;;
- -- ) shift; break ;;
- * ) break ;;
- esac
- done
- echo $USER
- for line in $(cat $INPUT_FILE); do
- CREDENTIALS=$(echo $line | tr -d \" | cut -d , -f 1-3)
- OUTFILE=$(echo $CREDENTIALS | cut -d , -f 1)
- USERNAME=$(echo $CREDENTIALS | cut -d , -f 2)
- PASSWORD=$(echo $CREDENTIALS | cut -d , -f 3)
- read -d '' DATA << EOF
- $PASSWORD
- Username: $USERNAME
- EOF
- cd ~/.password-store
- echo "$DATA" | gpg -e -r $USER -o $OUTFILE
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement