From 983a7f6da40104a851bc2882646bfc54ce53db8b Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 7 May 2014 23:24:38 +0400 Subject: [PATCH 1/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 61b2fb1..9e15b66 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ Show help screen: # TODO +* Import/Export with simple(only password) encryption * Password lenght * Store decrypted DB into RAM not in /tmp/ * Different keys selection From 76a5f746ac79e661222681381fd219a933ae2693 Mon Sep 17 00:00:00 2001 From: Difrex Date: Thu, 8 May 2014 00:21:22 +0400 Subject: [PATCH 2/4] colors support --- pm.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pm.pl b/pm.pl index 38ef40c..9b9d2b9 100755 --- a/pm.pl +++ b/pm.pl @@ -77,9 +77,15 @@ if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) { my $get_pass = $get_h->{password}; $copy->copy($get_pass); - - print "Password copied to xclipboard.\nURI is " - . $get_h->{resource} . "\n"; + # TEST + use Term::ANSIColor; + print color 'green'; + print "Password copied to xclipboard."; + print color 'reset'; + print "\nURI is "; + print color 'bold blue'; + print $get_h->{resource} . "\n"; + print color 'reset'; } elsif ( defined($opt_s) and defined($opt_n) and defined($opt_o) ) { From 2d28e2430288a87f1fad326d4cfd8f6164299ca8 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 10 May 2014 20:52:30 +0400 Subject: [PATCH 3/4] Keys selection --- GPG.pm | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/GPG.pm b/GPG.pm index 890ce18..3011137 100644 --- a/GPG.pm +++ b/GPG.pm @@ -10,7 +10,10 @@ sub new { my $home = $ENV{HOME}; my $db = $home . "/.PM/db.sqlite"; - my $self = { _db => $db, }; + my $self = { + _db => $db, + _home => $home, + }; bless $self, $class; return $self; @@ -26,13 +29,30 @@ sub encrypt_db { @rm_db = ( "rm", "-f", "$db" ); system(@rm_db) == 0 or die "Cannot remove old database: $!\n"; - # gpg --output test.gpg --encrypt test -a --default-recipient-self - @enc_cmd = ( - "gpg", "--output", "$db", - "-a", "--default-recipient-self", - "--encrypt", "$file", - ); - + # Keys selection. + my @enc_cmd; + my $recipient; + if ( -e $self->{_home} . "/.PM/.key" ) { + open my $key_f, "<" , $self->{_home} . "/.PM/.key" + or die "Cannot open file: $!\n"; + while ( <$key_f> ) { + $recipient = $_; + } + @enc_cmd = ( + "gpg", "--output", "$db", + "-a", "--recipient", "$recipient", + "--encrypt", "$file", + ); + } + else { + # gpg --output test.gpg --encrypt test -a --default-recipient-self + @enc_cmd = ( + "gpg", "--output", "$db", + "-a", "--default-recipient-self", + "--encrypt", "$file", + ); + } + system(@enc_cmd) == 0 or die "Cannot encrypt!\nDecrypted file: $file\nTraceback: $!\n"; From dc02dc252f795c89a40fe85b9b78451fcb28b078 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 10 May 2014 20:59:08 +0400 Subject: [PATCH 4/4] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e15b66..52368f4 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,16 @@ Set this key(or another of cource) for default: vim ~/.gnupg/gpg.conf # find string and uncomment or add it - default-key your@mail-address-key.org + default-key key_email@example.com :wq +You can use not default key: + + # Create file with key email + cat > ~/.PM/.key << EOF + key_email@example.com + EOF + First run: $ ./pm.pl @@ -65,4 +72,3 @@ Show help screen: * Import/Export with simple(only password) encryption * Password lenght * Store decrypted DB into RAM not in /tmp/ -* Different keys selection