change sec1210 footprint to handsoldering
[hardpass.git] / oled / pass-test.sh
CommitLineData
bc85b807 1#!/bin/bash
2
3# (c) 2016 Tobias Girstmair
4# traverse password store on the oled
5
6LAYER=1 #for awk call
7SELECTED=""
8while true; do
9sudo ./oled_menu $(pass list $SELECTED | tail -n +2|awk -F/ "{ print \$${LAYER} }" | sed 's/\.gpg\(\x1B\[[0-9]\+m\)\{0,1\}\( ->\|$\)/\1\2/g' | uniq |cut -c 1-21|xargs echo)
10RETVAL=$?
11
12NEW=$(pass list $SELECTED| tail -n +2 | awk -F/ "{ print \$${LAYER} }" | uniq |head -n $((RETVAL)) | tail -n 1)
13
14if [ -z "$SELECTED" ]; then
15 SELECTED=$NEW
16else
17 SELECTED=${SELECTED}/$NEW
18fi
19
20if [[ "$SELECTED" == *.gpg ]]; then
21 # is a file
22 echo "Requested Password: $(echo $SELECTED|sed 's/\.gpg//g')"
23 echo "Username: $(echo $NEW|sed 's/\.gpg//g')"
24 # PASSWORD_STORE_GPG_OPTS="--passphrase 12345" pass show $(echo $SELECTED|sed 's/\.gpg\(\x1B\[[0-9]\+m\)\{0,1\}\( ->\|$\)/\1\2/g') | head -n 1 | xargs echo -n |sudo ./scan /dev/hidg0 2 2
25 break
26else
27 #is a dir
28 LAYER=$((LAYER+1))
29 continue
30fi
31done
Imprint / Impressum