[pass] [PATCH] Added metadata option to the show command
Sebastian Verschoor
s.r.verschoor at student.tue.nl
Sun Sep 13 18:42:50 CEST 2015
Often. I forget the username or email that I used when I subscribed to
a service. I store it in the password-store using multiline format. I
use `pass show` to find this information. However, this makes the
password vulnerable to shoulder surfing. I'd like an option where I
only display the username/email/other metadata.
---
src/password-store.sh | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/password-store.sh b/src/password-store.sh
index d535a74..dafbdf7 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -223,9 +223,10 @@ cmd_usage() {
List passwords.
$PROGRAM find pass-names...
List passwords that match pass-names.
- $PROGRAM [show] [--clip,-c] pass-name
- Show existing password and optionally put it on the clipboard.
+ $PROGRAM [show] [--clip,-c | --meta,-m] pass-name
+ Show existing password data and optionally put the password on
the clipboard.
If put on the clipboard, it will be cleared in $CLIP_TIME
seconds.
+ If meta, only display the password metadata (everything but
the first line).
$PROGRAM grep search-string
Search for password files containing search-string when
decrypted.
$PROGRAM insert [--echo,-e | --multiline,-m] [--force,-f] pass-name
@@ -294,12 +295,13 @@ cmd_init() {
}
cmd_show() {
- local opts clip=0
- opts="$($GETOPT -o c -l clip -n "$PROGRAM" -- "$@")"
+ local opts clip=0 meta=0
+ opts="$($GETOPT -o cm -l clip,meta -n "$PROGRAM" -- "$@")"
local err=$?
eval set -- "$opts"
while true; do case $1 in
-c|--clip) clip=1; shift ;;
+ -m|--meta) meta=1; shift ;;
--) shift; break ;;
esac done
@@ -310,7 +312,11 @@ cmd_show() {
check_sneaky_paths "$path"
if [[ -f $passfile ]]; then
if [[ $clip -eq 0 ]]; then
- $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?
+ if [[ $meta -eq 0 ]]; then
+ $GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?
+ else
+ $GPG -d "${GPG_OPTS[@]}" "$passfile" | tail --lines=+2 ||
exit$?
+ fi
else
local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n
1)"
[[ -n $pass ]] || exit 1
--
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20150913/c6a3aaa3/attachment.html>
More information about the Password-Store
mailing list