From 2fdaecf3451e3f2a64e71092ccb57aae936340d5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 19 Aug 2016 10:14:43 +0200 Subject: Initial commit --- greppw.in | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 greppw.in (limited to 'greppw.in') diff --git a/greppw.in b/greppw.in new file mode 100755 index 0000000..e0b3b03 --- /dev/null +++ b/greppw.in @@ -0,0 +1,29 @@ +#!/bin/bash + +. #ETCDIR#/passwort-tresor.konf + +echo "Dienst: " +read dienst + +tmpMsg=$(mktemp /tmp/emsg.XXXXXX) + +text="$(ssh 141.35.50.159 "cat ~/Dokumente/pws.gpg" | gpg -o - -d - 2> ${tmpMsg})" + +if [ ! $(grep -c "Good signature from \"Erich Eckner \([^\"]*\)\?\"" ${tmpMsg}) -eq 1 ] || [ ! $(grep -c "Signature made .* using RSA key ID 0AEEC90755DA7B5A" ${tmpMsg}) -eq 1 ] +then + dialog --textbox ${tmpMsg} 14 70 +fi + +rm -f ${tmpMsg} + +[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="^${dienst}" +[ $(echo -e "${text}" | grep -c "${dienst}") -gt 1 ] && dienst="${dienst}:\$" +[ $(echo -e "${text}" | grep -c "${dienst}") -eq 1 ] || exit 1 + +text="$(echo "${text}" | grep -2 "${dienst}" | tail -n2)" +echo "${text}" | head -n1 | xclip -i +echo -n "." +read dienst +echo "${text}" | tail -n1 | xclip -i +echo -n "." +read dienst -- cgit v1.2.3-54-g00ecf