From fd1684051542a8d5bff705fa023ee4838c42d034 Mon Sep 17 00:00:00 2001 From: Nikola Petrov Date: Mon, 5 Feb 2024 15:22:07 +0100 Subject: [PATCH] sort lables before printing --- source/arg_func.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/arg_func.cpp b/source/arg_func.cpp index 95ad608..cd6373d 100644 --- a/source/arg_func.cpp +++ b/source/arg_func.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "arg_func.hpp" #include "func.hpp" @@ -199,9 +200,18 @@ void arg_list(Buffer &decrypted_buffer) Index *index = (Index *)decrypted_buffer.buffer; LoginInfo *pass = (LoginInfo *)(decrypted_buffer.buffer + sizeof(Index)); + std::vector list; + for (size_t i = 0; i < index->count; i++) { - printf("label: %s\n", decrypted_buffer.buffer + pass[i].label + index->offset); + list.emplace_back(std::string((char *)decrypted_buffer.buffer + pass[i].label + index->offset)); + } + + std::sort(list.begin(), list.end()); + + for (auto &&str : list) + { + printf("%s\n", str.c_str()); } }