Merge branch 'master' into 'master'
Fixed conversion for password with escape character using TAB delimiter See merge request unitoo/pass-exporter!2
This commit is contained in:
commit
346934cc06
2 changed files with 4 additions and 3 deletions
|
@ -4,7 +4,7 @@ This repository contains some scripts that aims to convert a gpg password wallet
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
### convert_to_csv.sh
|
### convert_to_csv.sh
|
||||||
Simply execute the script. You need `pass` executable installed and ENV var PASSWORD_STORE_DIR set-up. A CSV file will be created in this folder containing key-password fields separated by semicolon and delimited by `"`.
|
Simply execute the script. You need `pass` executable installed and ENV var PASSWORD_STORE_DIR set-up. A CSV file will be created in this folder containing key-password fields separated by TAB delimiter.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone this repository
|
# Clone this repository
|
||||||
|
|
|
@ -15,13 +15,14 @@ fi
|
||||||
BASE_NAME=passwords
|
BASE_NAME=passwords
|
||||||
CURRENT_DATE=$(date "+%Y-%m-%d")
|
CURRENT_DATE=$(date "+%Y-%m-%d")
|
||||||
FINAL_FILE_NAME=${BASE_NAME}_${CURRENT_DATE}.csv
|
FINAL_FILE_NAME=${BASE_NAME}_${CURRENT_DATE}.csv
|
||||||
|
DELIMITER=$'\t'
|
||||||
|
|
||||||
if [[ -f "$FINAL_FILE_NAME" ]]; then
|
if [[ -f "$FINAL_FILE_NAME" ]]; then
|
||||||
echo "A file with name $FINAL_FILE_NAME already exists! Please rename or delete and re-execute this script."
|
echo "A file with name $FINAL_FILE_NAME already exists! Please rename or delete and re-execute this script."
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
touch $FINAL_FILE_NAME
|
touch $FINAL_FILE_NAME
|
||||||
echo "\"Account\";\"Password\";\"Login\"" >> $FINAL_FILE_NAME
|
echo "Account${DELIMITER}Password${DELIMITER}Login" >> $FINAL_FILE_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$FINAL_FILE_NAME" ]]; then
|
if [[ -f "$FINAL_FILE_NAME" ]]; then
|
||||||
|
@ -36,7 +37,7 @@ if [[ -f "$FINAL_FILE_NAME" ]]; then
|
||||||
GPG_FILE_NAME=${GPG_FILE_NAME//\// > }
|
GPG_FILE_NAME=${GPG_FILE_NAME//\// > }
|
||||||
|
|
||||||
echo "Processing ${GPG_FILE_NAME}";
|
echo "Processing ${GPG_FILE_NAME}";
|
||||||
echo "\"$GPG_FILE_NAME\";\"$PASSWORD\";\"$LOGIN_KEY\"" >> $FINAL_FILE_NAME
|
echo "$GPG_FILE_NAME$DELIMITER$PASSWORD$DELIMITER$LOGIN_KEY" >> $FINAL_FILE_NAME
|
||||||
}; done;
|
}; done;
|
||||||
unset f;
|
unset f;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue