[PATCH] add new dump command

Dusty Mabe dusty at dustymabe.com
Sat Feb 4 18:15:12 CET 2017


This dump command will decrypt all passwords and print them.
For example if we have the following password store:

$ pass ls
 Password Store
 └── www
     └── google.com
     └── att.com

Then `pass dump` would show

$ pass dump
[www/google.com]
mygooglepassword

[www/att.com]
myat&tpassword

I find this useful for piping the output into vim and then
searching the content for information I've stored.
---
 src/password-store.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/password-store.sh b/src/password-store.sh
index 081057a..16a06b4 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -380,6 +380,16 @@ cmd_show() {
 	fi
 }
 
+cmd_dump() {
+	pushd $PREFIX > /dev/null
+	find ./* -name *gpg | while read file; do
+		echo "[$file]" | sed 's/\.\///' | sed 's/\.gpg//'
+		$GPG ${GPG_OPTS[@]} -d $file
+		echo -en "\n\n"
+	done
+	popd > /dev/null
+}
+
 cmd_find() {
 	[[ -z "$@" ]] && die "Usage: $PROGRAM $COMMAND pass-names..."
 	IFS="," eval 'echo "Search Terms: $*"'
@@ -669,6 +679,7 @@ case "$1" in
 	rename|mv) shift;		cmd_copy_move "move" "$@" ;;
 	copy|cp) shift;			cmd_copy_move "copy" "$@" ;;
 	git) shift;			cmd_git "$@" ;;
+	dump) shift;			cmd_dump ;;
 	*)				cmd_extension_or_show "$@" ;;
 esac
 exit 0
-- 
2.7.4



More information about the Password-Store mailing list