parent
10026e374d
commit
e465310dc7
17
GPG.pm
17
GPG.pm
@ -109,21 +109,4 @@ sub export {
|
|||||||
return $export_file;
|
return $export_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub import {
|
|
||||||
my ( $self, $file ) = @_;
|
|
||||||
|
|
||||||
# Generate random file name
|
|
||||||
my @chars = ( "A" .. "Z", "a" .. "z" );
|
|
||||||
my $string;
|
|
||||||
$string .= $chars[ rand @chars ] for 1 .. 10;
|
|
||||||
my $dec_file = "/tmp/pm." . $string;
|
|
||||||
|
|
||||||
# Decrypt database
|
|
||||||
# gpg --output filepath --decrypt encfile
|
|
||||||
my @dec_cmd = ( 'gpg', '--output', $dec_file, '--decrypt', $file );
|
|
||||||
system(@dec_cmd) == 0 or die "Cannot decrypt file $file: $!\n";
|
|
||||||
|
|
||||||
return $dec_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
34
Password.pm
34
Password.pm
@ -81,6 +81,19 @@ sub remove {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub export {
|
||||||
|
my ( $self, $filename ) = @_;
|
||||||
|
my $gpg = $self->{_gpg};
|
||||||
|
|
||||||
|
my $dec_db_file = $gpg->decrypt_db();
|
||||||
|
my $export_enc = $gpg->export($dec_db_file);
|
||||||
|
|
||||||
|
my @mv_cmd = ( 'mv', "$export_enc", "$filename" );
|
||||||
|
system(@mv_cmd) == 0 or die "Cannot move $export_enc to $filename: $!\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
# Decrypt base and store new password
|
# Decrypt base and store new password
|
||||||
sub save {
|
sub save {
|
||||||
my ( $self, $store ) = @_;
|
my ( $self, $store ) = @_;
|
||||||
@ -121,27 +134,6 @@ sub save {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub export {
|
|
||||||
my ( $self, $filename ) = @_;
|
|
||||||
my $gpg = $self->{_gpg};
|
|
||||||
|
|
||||||
my $dec_db_file = $gpg->decrypt_db();
|
|
||||||
my $export_enc = $gpg->export($dec_db_file);
|
|
||||||
|
|
||||||
my @mv_cmd = ( 'mv', "$export_enc", "$filename" );
|
|
||||||
system(@mv_cmd) == 0 or die "Cannot move $export_enc to $filename: $!\n";
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub import {
|
|
||||||
my ( $self, $file ) = @_;
|
|
||||||
my $gpg = $self->{_gpg};
|
|
||||||
my $db_class = $self->{_db};
|
|
||||||
|
|
||||||
my $dec_file = $gpg->import($file);
|
|
||||||
}
|
|
||||||
|
|
||||||
# Generate password
|
# Generate password
|
||||||
sub generate {
|
sub generate {
|
||||||
my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9 );
|
my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9 );
|
||||||
|
1
Usage.pm
1
Usage.pm
@ -25,7 +25,6 @@ Simple password manager writed in Perl.
|
|||||||
-i password ID
|
-i password ID
|
||||||
-o open link
|
-o open link
|
||||||
-x [filename] export
|
-x [filename] export
|
||||||
-I [filename] import
|
|
||||||
-h show this help screen and exit
|
-h show this help screen and exit
|
||||||
-v show version info and exit
|
-v show version info and exit
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user