From 12905ad6b72afe62e50d0587f0e92fa42969e63c Mon Sep 17 00:00:00 2001 From: Nikola Petrov Date: Mon, 22 Jul 2024 23:04:51 +0200 Subject: [PATCH] update print_all_p to handle multi line passwords/nots --- source/arg_func.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/source/arg_func.cpp b/source/arg_func.cpp index 18c5305..fc4967a 100644 --- a/source/arg_func.cpp +++ b/source/arg_func.cpp @@ -272,13 +272,36 @@ void arg_print_all_p(Buffer &decrypted_buffer, std::string &user_pass) Index *index = (Index *)decrypted_buffer.buffer; LoginInfo *pass = (LoginInfo *)(decrypted_buffer.buffer + sizeof(Index)); + std::vector notes; printf("\n"); + + auto is_note = [](const uint8_t *c) + { while(*c!='\0'){if(*c == '\n') return true;c++;} return false; }; + for (size_t i = 0; i < index->count; i++) { + const uint8_t *p = decrypted_buffer.buffer + pass[i].password + index->offset; + if (is_note(p)) + { + notes.push_back(i); + continue; + } + printf("label: %-20s\t", decrypted_buffer.buffer + pass[i].label + index->offset); printf("username: %-30s\t", decrypted_buffer.buffer + pass[i].username + index->offset); printf("password: %s\n", decrypted_buffer.buffer + pass[i].password + index->offset); } + + for (size_t i = 0; i < notes.size(); i++) + { + size_t j = notes[i]; + printf("\n"); + printf("-----------------------------------------------------------------------------------------------------------\n"); + printf("label: %-20s\t", decrypted_buffer.buffer + pass[j].label + index->offset); + printf("username: %-30s\t", decrypted_buffer.buffer + pass[j].username + index->offset); + printf("-----------------------------------------------------------------------------------------------------------\n"); + printf("%s", decrypted_buffer.buffer + pass[j].password + index->offset); + } } void arg_change(Buffer &decrypted_buffer, Buffer &encrypted_buffer, std::string &user_pass)