Added gitignore to prevent incidental CSV upload. Now with awk login key is added to CSV (imperfect but works). Updated README

This commit is contained in:
Claudio Maradonna 2021-02-21 10:55:38 +01:00
parent ad08683f20
commit 266861d2b0
Signed by: claudiomaradonna
GPG key ID: B1EDCB4C3B05C387
3 changed files with 8 additions and 4 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.csv

View file

@ -24,6 +24,8 @@ $ ./SCRIPT.sh
## Todo ## Todo
* Create a script to convert into KeePassX format * Create a script to convert into KeePassX format
* Use pass executable only one time and use content
* Write file only at the end of the script
## Credits ## Credits

View file

@ -2,7 +2,7 @@
PASS_EXECUTABLE=pass PASS_EXECUTABLE=pass
if ! hash pass 2> /dev/null; then if ! hash $PASS_EXECUTABLE 2> /dev/null; then
echo "Pass executable not found. This script use pass to convert gpg password wallet. Exiting." echo "Pass executable not found. This script use pass to convert gpg password wallet. Exiting."
exit exit
fi fi
@ -21,7 +21,7 @@ if [[ -f "$FINAL_FILE_NAME" ]]; then
exit exit
else else
touch $FINAL_FILE_NAME touch $FINAL_FILE_NAME
echo "\"Account\";\"Password\"" >> $FINAL_FILE_NAME echo "\"Account\";\"Password\";\"Login\"" >> $FINAL_FILE_NAME
fi fi
if [[ -f "$FINAL_FILE_NAME" ]]; then if [[ -f "$FINAL_FILE_NAME" ]]; then
@ -29,13 +29,14 @@ if [[ -f "$FINAL_FILE_NAME" ]]; then
GPG_FILE_NAME="${f:${#PASSWORD_STORE_DIR}+1}" GPG_FILE_NAME="${f:${#PASSWORD_STORE_DIR}+1}"
GPG_FILE_NAME=${GPG_FILE_NAME/\.gpg/} GPG_FILE_NAME=${GPG_FILE_NAME/\.gpg/}
PASSWORD=$(pass show "$GPG_FILE_NAME" | head -n1) PASSWORD=$($PASS_EXECUTABLE show "$GPG_FILE_NAME" | head -n1)
PASSWORD=${PASSWORD/\"/\\\"} PASSWORD=${PASSWORD/\"/\\\"}
LOGIN_KEY=$($PASS_EXECUTABLE show "$GPG_FILE_NAME" | awk '/login/ || /ID/ || /email/ {print $2}')
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\"" >> $FINAL_FILE_NAME echo "\"$GPG_FILE_NAME\";\"$PASSWORD\";\"$LOGIN_KEY\"" >> $FINAL_FILE_NAME
}; done; }; done;
unset f; unset f;