WIP editor
Can only read the password no safe for edit
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "func.hpp"
|
||||
#include "buffer.hpp"
|
||||
#include "aes256.hpp"
|
||||
#include "editor.hpp"
|
||||
|
||||
void print_args()
|
||||
{
|
||||
@@ -27,6 +28,7 @@ void print_args()
|
||||
printf(" -s <label> show password for this label\n");
|
||||
printf(" -u <label> update username for this label\n");
|
||||
printf(" -n <label> update label name\n");
|
||||
printf(" -e <label> open editor, password as note\n");
|
||||
printf(" -l list all labels\n");
|
||||
printf(" -p print all passwords\n");
|
||||
printf(" -c change master password\n");
|
||||
@@ -84,6 +86,8 @@ Arg get_args(int argc, char **argv, char **label)
|
||||
return Arg::Name;
|
||||
case 'f':
|
||||
return Arg::File;
|
||||
case 'e':
|
||||
return Arg::Editor;
|
||||
|
||||
default:
|
||||
return Arg::Error;
|
||||
@@ -358,4 +362,21 @@ void arg_file(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *la
|
||||
void arg_size(Buffer &encrypted_buffer)
|
||||
{
|
||||
printf("File size is: %zuB\n", encrypted_buffer.taken);
|
||||
}
|
||||
|
||||
void arg_editor(Buffer &decrypted_buffer, Buffer &encrypted_buffer, const char *label_to_del, std::string &key)
|
||||
{
|
||||
int pass = find_logininfo_in_buffer(decrypted_buffer, label_to_del);
|
||||
if (pass < 0)
|
||||
{
|
||||
printf("Password not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
LoginInfoPointer lip = get_logininfo_pointer_from_buffer(decrypted_buffer, pass);
|
||||
edit_file(lip.password);
|
||||
|
||||
// delete_logininfo_from_buffer(decrypted_buffer, pass);
|
||||
// Aes256::encrypt(key, decrypted_buffer, encrypted_buffer);
|
||||
// encrypted_buffer.save_to_file();
|
||||
}
|
||||
Reference in New Issue
Block a user