summaryrefslogtreecommitdiff
path: root/bin/raps2
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-02-18 20:38:14 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-02-18 20:38:14 +0100
commit5334417c276293b5547b2fbb8714614cac5e1298 (patch)
tree53352aaf3e9a54ec40b8cb8251f2b3631c82b2c0 /bin/raps2
parentf97dc34bd88bae0cdc41a827d80f998849824a01 (diff)
Add raps2 dump
Diffstat (limited to 'bin/raps2')
-rwxr-xr-xbin/raps224
1 files changed, 24 insertions, 0 deletions
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) }
}