[pass] [PATCH] Added metadata option to the show command
Sebastian Verschoor
s.r.verschoor at student.tue.nl
Tue Sep 15 21:42:27 CEST 2015
On 15 September 2015 at 14:08, Steffen Vogel <post at steffenvogel.de> wrote:
> Usually you add the patches as inline text.
> Git also provides tools to automatically send the mails for you („git send-mail“ or so)
I tried that, but it didn't work (I'm not sure why, because sendmail
reported "Result: OK"). I'll put the patch inline below and try
again...
>
> Is there a reason, you only replied to me and not the whole list?
Nope, just hitted reply in my client (gmail) when I got my email.
>
> Cheers,
>
> Steffen
>
> —
>
> Steffen Vogel
> Robensstraße 69
> 52070 Aachen
>
> Mail: post at steffenvogel.de
> Mobil: +49 1575 7180927
> Web: http://www.steffenvogel.de
> Jabber: steffen.vogel at jabber.rwth-aachen.de
>
>> Am 14.09.2015 um 16:06 schrieb Sebastian Verschoor <s.r.verschoor at student.tue.nl>:
>>
>> > Hi,
>> >
>> > > 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.
>> >
>> > I like this idea. But maybe it’s possible to use this switch together with the —copy option?
>> > I usually copy the password to my clipboard which requires me to call pass twice.
>> > As I use a hardware token and disabled key phrase caching, this takes some time..
>> >
>> > Cheers
>> >
>>
>> That would be an even better way to do it :) I have attached the patches that should
>> implement this. (I am a bit of a git noob: are these attachements enough for you to
>> get this working in the software?)
>>
>> Best regards,
>> Sebastian
>> <0001-Added-metadata-option-to-the-show-command.patch><0002-Added-meta-copy-option-to-pass-show.patch>
>
The --meta flag to the `pass show` command also works in combination
with the --clip flag.
---
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 dafbdf7..1b0fc94 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -301,7 +301,7 @@ cmd_show() {
eval set -- "$opts"
while true; do case $1 in
-c|--clip) clip=1; shift ;;
- -m|--meta) meta=1; shift ;;
+ -m|--meta) meta=1; shift ;;
--) shift; break ;;
esac done
@@ -315,12 +315,18 @@ cmd_show() {
if [[ $meta -eq 0 ]]; then
$GPG -d "${GPG_OPTS[@]}" "$passfile" || exit $?
else
- $GPG -d "${GPG_OPTS[@]}" "$passfile" | tail
--lines=+2 || exit$?
+ $GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n +2 || exit $?
fi
else
- local pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | head -n 1)"
- [[ -n $pass ]] || exit 1
- clip "$pass" "$path"
+ firstline=1
+ $GPG -d "${GPG_OPTS[@]}" "$passfile" | while IFS= read -r
line || [[ -n $line ]]; do
+ if [[ $firstline -eq 1 ]]; then
+ firstline=0
+ clip "$line" "$path"
+ elif [[ $meta -eq 1 ]]; then
+ echo "$line"
+ fi
+ done
fi
elif [[ -d $PREFIX/$path ]]; then
if [[ -z $path ]]; then
--
1.9.1
More information about the Password-Store
mailing list