Volver
- Download gpg-vi
#!/bin/bash # # Copyright (C) 2010, 2011 Juan Cespedes <cespedes@thehackers.org> FILE="$1" if [ ! "$FILE" ] then echo "Usage: $0 <file>" 1>&2 exit 1 fi TEMPFILE=$( tempfile 2>/dev/null || mktemp /tmp/file.XXXXXX ) sleep .2 echo -n "Please enter passphrase: " 1>&2 stty -echo read pass </dev/tty stty echo echo 1>&2 if [ -f "$FILE" ] then gpg --passphrase-fd 0 --output - $FILE > $TEMPFILE << EOF $pass EOF if [ "$?" != "0" ] then rm -f $TEMPFILE exit 1 fi MD5=$( md5sum $TEMPFILE 2>/dev/null || md5 $TEMPFILE ) else MD5=foo fi ${VISUAL:-${EDITOR:-vi}} $TEMPFILE MD5NEW=$( md5sum $TEMPFILE 2>/dev/null || md5 $TEMPFILE ) if [ "$?" = "0" -a "$MD5" != "$MD5NEW" ] then gpg --passphrase-fd 0 --symmetric --output - $TEMPFILE > $FILE <<EOF $pass EOF fi rm -f $TEMPFILE