diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-02-18 20:38:14 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-02-18 20:38:14 +0100 |
commit | 5334417c276293b5547b2fbb8714614cac5e1298 (patch) | |
tree | 53352aaf3e9a54ec40b8cb8251f2b3631c82b2c0 /bin | |
parent | f97dc34bd88bae0cdc41a827d80f998849824a01 (diff) |
Add raps2 dump
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/raps2 | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -67,6 +67,29 @@ sub cmd_add { save_state_to($store); } +sub cmd_dump { + my ($name) = @_; + my $store = get_xdg_data_home() . "/${name}"; + my $password; + my $cipher; + + if (not -e $store) { + die("No such password\n"); + } + + $password = get_password(); + load_state_from($store); + $cipher = setup_cipher($password); + + printf( + "%-12s %s\n" x 4, + 'URL' , $state{'url'}, + 'Login' , $state{'login'}, + 'Extra' , $state{'extra'} // q{}, + 'Password', $cipher->decrypt_hex($state{'hash'}), + ); +} + sub cmd_get { my ($name) = @_; my $store = get_xdg_data_home() . "/${name}"; @@ -287,6 +310,7 @@ create_dot_dirs(); given ($action) { when ('add') { cmd_add(@args) } + when ('dump') { cmd_dump(@args) } when ('get') { cmd_get(@args) } when ('info') { cmd_info(@args) } } |