| The Following 6 Users Say Thank You to roman4 For This Useful Post: | ||
|
|
2012-04-12
, 18:54
|
|
Posts: 6 |
Thanked: 0 times |
Joined on Jan 2012
@ germany
|
#2
|
|
|
2012-04-12
, 19:13
|
|
Posts: 5 |
Thanked: 8 times |
Joined on Jun 2010
|
#3
|
|
|
2012-04-14
, 11:25
|
|
Posts: 112 |
Thanked: 26 times |
Joined on Sep 2009
|
#4
|
|
|
2012-05-03
, 18:36
|
|
|
Posts: 3,790 |
Thanked: 5,718 times |
Joined on Mar 2006
@ Vienna, Austria
|
#5
|
![]() |
| Tags |
| decrypt, email, gnupg, openpgp |
|
MAXAGE=1 # search for files with GnuPG pattern files=`find /home/user/.qmf/mail/ -mtime -$MAXAGE | xargs grep -l GnuPG` nr_files=`echo $files | wc -w` # search successful? if [ $nr_files -gt 0 ] then # we found OpenPGP encryted files echo "$nr_files encrypted emails found." # loop through all of them for mail in $files do # handle current file #echo "Found "$mail # check if encryption is inline PGP or PGP/MIME attachment if [ `echo $mail | grep parts` ] then # found PGP/MIME # determine main email file by removing -part/2 suffix mainfile=`echo $mail | cut -d'-' -f 1` grep -i -e from: -e subject: $mainfile else # found inline PGP email grep -i -e from: -e subject: $mail fi # ask user whether we decrypt this file read -p "Take this email (Y|n)?" -n1 choice if [ $choice != "n" ] then gpg -d $mail | less exit fi done else echo "No GnuPG encrypted emails found during last $MAXAGE days." | less fiThe script searches for all encrypted email you received during the last day. If you want to increase the period, just change MAXAGE in /home/user/decrypt.
I hope this is useful for somebody else...