From 5334417c276293b5547b2fbb8714614cac5e1298 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 18 Feb 2011 20:38:14 +0100 Subject: Add raps2 dump --- bin/raps2 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bin/raps2 b/bin/raps2 index 9ab5a2d..5eaea47 100755 --- a/bin/raps2 +++ b/bin/raps2 @@ -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) } } -- cgit v1.2.3