Skip to content

Commit 228a17c

Browse files
committed
c++11 fixes
1 parent 8ede6f0 commit 228a17c

4 files changed

Lines changed: 104 additions & 52 deletions

File tree

src/cli/output.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ static void checker(const VM::enum_flags flag, const char* message) {
284284
std::ostringstream msg_oss;
285285

286286
if (result) {
287-
msg_oss << white << "🪲 " << white << detected << " " << white << "Checking " << message << "..." << ansi_exit << enum_name;
287+
msg_oss << white << "🪲 " << white << tag_detected << " " << white << "Checking " << message << "..." << ansi_exit << enum_name;
288288
} else {
289-
msg_oss << not_detected << " " << grey << "Checking " << message << "..." << ansi_exit << enum_name;
289+
msg_oss << tag_not_detected << " " << grey << "Checking " << message << "..." << ansi_exit << enum_name;
290290
}
291291

292292
PRINT_LINE(msg_oss.str());
@@ -462,8 +462,8 @@ void general(bool high_threshold, bool all, bool dynamic) {
462462
#endif
463463

464464
if (arg_bitset.test(NO_ANSI)) {
465-
detected = ("[ DETECTED ]");
466-
not_detected = (" [NOT DETECTED]");
465+
tag_detected = ("[ DETECTED ]");
466+
tag_not_detected = (" [NOT DETECTED]");
467467
bold = ""; underline = ""; ansi_exit = ""; red = ""; orange = "";
468468
green = ""; red_orange = ""; green_orange = ""; grey = ""; white = "";
469469
}

src/cli/strings.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "strings.hpp"
2+
3+
const std::string TH_DIM = "\x1B[38;2;60;60;60m";
4+
const std::string TH_MED = "\x1B[38;2;120;120;120m";
5+
const std::string TH_WHITE = "\x1B[38;2;255;255;255m";
6+
const std::string TH_RST = "\x1B[0m";
7+
8+
#if (CLI_WINDOWS)
9+
const std::string TH_BRIGHT = "\x1B[38;2;180;180;180m";
10+
const std::string TH_RED = "\x1B[38;2;220;0;0m";
11+
#endif
12+
13+
std::string bold = "\x1B[1;97m";
14+
std::string underline = "\x1B[4m";
15+
std::string ansi_exit = "\x1B[0m";
16+
std::string red = "\x1B[31m";
17+
std::string orange = "\x1B[38;2;180;50;0m";
18+
std::string green = "\x1B[38;2;60;60;60m";
19+
std::string red_orange = "\x1B[31m";
20+
std::string green_orange = "\x1B[38;2;60;60;60m";
21+
std::string grey = "\x1B[38;2;60;60;60m";
22+
std::string white = "\x1B[38;2;255;255;255m";
23+
24+
std::bitset<arg_bits> arg_bitset;
25+
26+
u8 unsupported_count = 0;
27+
u8 supported_count = 0;
28+
u8 no_perms_count = 0;
29+
u8 disabled_count = 0;
30+
31+
std::string tag_detected = ("\x1B[97m[\x1B[31m DETECTED \x1B[97m]\x1B[0m");
32+
std::string tag_not_detected = (" \x1B[97m[\x1B[90mNOT DETECTED\x1B[97m]\x1B[0m");

src/cli/strings.hpp

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,58 @@
2222
#define CLI_WINDOWS 0
2323
#endif
2424

25-
inline const std::string TH_DIM = "\x1B[38;2;60;60;60m";
26-
inline const std::string TH_MED = "\x1B[38;2;120;120;120m";
27-
inline const std::string TH_WHITE = "\x1B[38;2;255;255;255m";
28-
inline const std::string TH_RST = "\x1B[0m";
25+
extern const std::string TH_DIM;
26+
extern const std::string TH_MED;
27+
extern const std::string TH_WHITE;
28+
extern const std::string TH_RST;
2929

3030
#if (CLI_WINDOWS)
31-
inline const std::string TH_BRIGHT = "\x1B[38;2;180;180;180m";
32-
inline const std::string TH_RED = "\x1B[38;2;220;0;0m";
31+
extern const std::string TH_BRIGHT;
32+
extern const std::string TH_RED;
3333
#endif
3434

35-
inline std::string bold = "\x1B[1;97m";
36-
inline std::string underline = "\x1B[4m";
37-
inline std::string ansi_exit = "\x1B[0m";
38-
inline std::string red = "\x1B[31m";
39-
inline std::string orange = "\x1B[38;2;180;50;0m";
40-
inline std::string green = "\x1B[38;2;60;60;60m";
41-
inline std::string red_orange = "\x1B[31m";
42-
inline std::string green_orange = "\x1B[38;2;60;60;60m";
43-
inline std::string grey = "\x1B[38;2;60;60;60m";
44-
inline std::string white = "\x1B[38;2;255;255;255m";
35+
extern std::string bold;
36+
extern std::string underline;
37+
extern std::string ansi_exit;
38+
extern std::string red;
39+
extern std::string orange;
40+
extern std::string green;
41+
extern std::string red_orange;
42+
extern std::string green_orange;
43+
extern std::string grey;
44+
extern std::string white;
4545

4646
enum arg_enum : u8 {
47-
HELP, VERSION, ALL, DETECT, STDOUT, BRAND, BRAND_LIST, PERCENT, CONCLUSION, NUMBER, TYPE, OUTPUT, NOTES, HIGH_THRESHOLD, NO_ANSI, DYNAMIC, VERBOSE, ENUMS, DETECTED_ONLY, JSON, NULL_ARG
47+
HELP,
48+
VERSION,
49+
ALL,
50+
DETECT,
51+
STDOUT,
52+
BRAND,
53+
BRAND_LIST,
54+
PERCENT,
55+
CONCLUSION,
56+
NUMBER,
57+
TYPE,
58+
OUTPUT,
59+
NOTES,
60+
HIGH_THRESHOLD,
61+
NO_ANSI,
62+
DYNAMIC,
63+
VERBOSE,
64+
ENUMS,
65+
DETECTED_ONLY,
66+
JSON,
67+
NULL_ARG
4868
};
4969

5070
constexpr u8 arg_bits = static_cast<u8>(NULL_ARG) + 1;
51-
inline std::bitset<arg_bits> arg_bitset;
71+
extern std::bitset<arg_bits> arg_bitset;
5272

53-
inline u8 unsupported_count = 0;
54-
inline u8 supported_count = 0;
55-
inline u8 no_perms_count = 0;
56-
inline u8 disabled_count = 0;
73+
extern u8 unsupported_count;
74+
extern u8 supported_count;
75+
extern u8 no_perms_count;
76+
extern u8 disabled_count;
5777

58-
inline std::string detected = ("\x1B[97m[\x1B[31m DETECTED \x1B[97m]\x1B[0m");
59-
inline std::string not_detected = (" \x1B[97m[\x1B[90mNOT DETECTED\x1B[97m]\x1B[0m");
78+
extern std::string tag_detected;
79+
extern std::string tag_not_detected;

src/cli/windows_cli.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -544,37 +544,37 @@ LONG WINAPI VehLogger(PEXCEPTION_POINTERS ep) {
544544
};
545545

546546
std::vector<std::string> lines;
547-
lines.push_back(c_gry + "Exception Hit: " + c_val + to_hex(ep->ExceptionRecord->ExceptionCode) + c_rst);
548-
lines.push_back(c_gry + "Address: " + c_val + to_hex(ep->ExceptionRecord->ExceptionAddress) + c_rst);
549-
lines.push_back(c_gry + "Flags: " + c_val + hex_pad(ep->ExceptionRecord->ExceptionFlags, 6) + c_gry + " Params: " + c_val + std::to_string(ep->ExceptionRecord->NumberParameters) + c_rst);
547+
lines.push_back(c_grey + "Exception Hit: " + c_white + to_hex(ep->ExceptionRecord->ExceptionCode) + c_rst);
548+
lines.push_back(c_grey + "Address: " + c_white + to_hex(ep->ExceptionRecord->ExceptionAddress) + c_rst);
549+
lines.push_back(c_grey + "Flags: " + c_white + hex_pad(ep->ExceptionRecord->ExceptionFlags, 6) + c_grey + " Params: " + c_white + std::to_string(ep->ExceptionRecord->NumberParameters) + c_rst);
550550
lines.push_back("");
551551

552552
#ifdef _M_X64
553-
lines.push_back(c_gry + "RIP: " + c_val + hex_pad(ep->ContextRecord->Rip, 18) + c_gry + " RSP: " + c_val + to_hex(ep->ContextRecord->Rsp) + c_rst);
554-
lines.push_back(c_gry + "RAX: " + c_val + hex_pad(ep->ContextRecord->Rax, 18) + c_gry + " RCX: " + c_val + to_hex(ep->ContextRecord->Rcx) + c_rst);
555-
lines.push_back(c_gry + "RDX: " + c_val + hex_pad(ep->ContextRecord->Rdx, 18) + c_gry + " RBX: " + c_val + to_hex(ep->ContextRecord->Rbx) + c_rst);
556-
lines.push_back(c_gry + "RBP: " + c_val + hex_pad(ep->ContextRecord->Rbp, 18) + c_gry + " RSI: " + c_val + to_hex(ep->ContextRecord->Rsi) + c_rst);
557-
lines.push_back(c_gry + "RDI: " + c_val + hex_pad(ep->ContextRecord->Rdi, 18) + c_gry + " EFL: " + c_val + to_hex(ep->ContextRecord->EFlags) + c_rst);
558-
lines.push_back(c_gry + "R8 : " + c_val + hex_pad(ep->ContextRecord->R8, 18) + c_gry + " R9 : " + c_val + to_hex(ep->ContextRecord->R9) + c_rst);
559-
lines.push_back(c_gry + "R10: " + c_val + hex_pad(ep->ContextRecord->R10, 18) + c_gry + " R11: " + c_val + to_hex(ep->ContextRecord->R11) + c_rst);
560-
lines.push_back(c_gry + "R12: " + c_val + hex_pad(ep->ContextRecord->R12, 18) + c_gry + " R13: " + c_val + to_hex(ep->ContextRecord->R13) + c_rst);
561-
lines.push_back(c_gry + "R14: " + c_val + hex_pad(ep->ContextRecord->R14, 18) + c_gry + " R15: " + c_val + to_hex(ep->ContextRecord->R15) + c_rst);
553+
lines.push_back(c_grey + "RIP: " + c_white + hex_pad(ep->ContextRecord->Rip, 18) + c_grey + " RSP: " + c_white + to_hex(ep->ContextRecord->Rsp) + c_rst);
554+
lines.push_back(c_grey + "RAX: " + c_white + hex_pad(ep->ContextRecord->Rax, 18) + c_grey + " RCX: " + c_white + to_hex(ep->ContextRecord->Rcx) + c_rst);
555+
lines.push_back(c_grey + "RDX: " + c_white + hex_pad(ep->ContextRecord->Rdx, 18) + c_grey + " RBX: " + c_white + to_hex(ep->ContextRecord->Rbx) + c_rst);
556+
lines.push_back(c_grey + "RBP: " + c_white + hex_pad(ep->ContextRecord->Rbp, 18) + c_grey + " RSI: " + c_white + to_hex(ep->ContextRecord->Rsi) + c_rst);
557+
lines.push_back(c_grey + "RDI: " + c_white + hex_pad(ep->ContextRecord->Rdi, 18) + c_grey + " EFL: " + c_white + to_hex(ep->ContextRecord->EFlags) + c_rst);
558+
lines.push_back(c_grey + "R8 : " + c_white + hex_pad(ep->ContextRecord->R8, 18) + c_grey + " R9 : " + c_white + to_hex(ep->ContextRecord->R9) + c_rst);
559+
lines.push_back(c_grey + "R10: " + c_white + hex_pad(ep->ContextRecord->R10, 18) + c_grey + " R11: " + c_white + to_hex(ep->ContextRecord->R11) + c_rst);
560+
lines.push_back(c_grey + "R12: " + c_white + hex_pad(ep->ContextRecord->R12, 18) + c_grey + " R13: " + c_white + to_hex(ep->ContextRecord->R13) + c_rst);
561+
lines.push_back(c_grey + "R14: " + c_white + hex_pad(ep->ContextRecord->R14, 18) + c_grey + " R15: " + c_white + to_hex(ep->ContextRecord->R15) + c_rst);
562562
lines.push_back("");
563-
lines.push_back(c_gry + "CS: " + c_val + hex_pad(ep->ContextRecord->SegCs, 8) + c_gry + " DS: " + c_val + hex_pad(ep->ContextRecord->SegDs, 8) + c_gry + " SS: " + c_val + to_hex(ep->ContextRecord->SegSs) + c_rst);
564-
lines.push_back(c_gry + "ES: " + c_val + hex_pad(ep->ContextRecord->SegEs, 8) + c_gry + " FS: " + c_val + hex_pad(ep->ContextRecord->SegFs, 8) + c_gry + " GS: " + c_val + to_hex(ep->ContextRecord->SegGs) + c_rst);
563+
lines.push_back(c_grey + "CS: " + c_white + hex_pad(ep->ContextRecord->SegCs, 8) + c_grey + " DS: " + c_white + hex_pad(ep->ContextRecord->SegDs, 8) + c_grey + " SS: " + c_white + to_hex(ep->ContextRecord->SegSs) + c_rst);
564+
lines.push_back(c_grey + "ES: " + c_white + hex_pad(ep->ContextRecord->SegEs, 8) + c_grey + " FS: " + c_white + hex_pad(ep->ContextRecord->SegFs, 8) + c_grey + " GS: " + c_white + to_hex(ep->ContextRecord->SegGs) + c_rst);
565565
lines.push_back("");
566-
lines.push_back(c_gry + "Dr0: " + c_val + hex_pad(ep->ContextRecord->Dr0, 18) + c_gry + " Dr1: " + c_val + to_hex(ep->ContextRecord->Dr1) + c_rst);
567-
lines.push_back(c_gry + "Dr2: " + c_val + hex_pad(ep->ContextRecord->Dr2, 18) + c_gry + " Dr3: " + c_val + to_hex(ep->ContextRecord->Dr3) + c_rst);
568-
lines.push_back(c_gry + "Dr6: " + c_val + hex_pad(ep->ContextRecord->Dr6, 18) + c_gry + " Dr7: " + c_val + to_hex(ep->ContextRecord->Dr7) + c_rst);
566+
lines.push_back(c_grey + "Dr0: " + c_white + hex_pad(ep->ContextRecord->Dr0, 18) + c_grey + " Dr1: " + c_white + to_hex(ep->ContextRecord->Dr1) + c_rst);
567+
lines.push_back(c_grey + "Dr2: " + c_white + hex_pad(ep->ContextRecord->Dr2, 18) + c_grey + " Dr3: " + c_white + to_hex(ep->ContextRecord->Dr3) + c_rst);
568+
lines.push_back(c_grey + "Dr6: " + c_white + hex_pad(ep->ContextRecord->Dr6, 18) + c_grey + " Dr7: " + c_white + to_hex(ep->ContextRecord->Dr7) + c_rst);
569569
lines.push_back("");
570-
lines.push_back(c_gry + "ContextFlags: " + c_val + hex_pad(ep->ContextRecord->ContextFlags, 10) + c_gry + " MxCsr: " + c_val + to_hex(ep->ContextRecord->MxCsr) + c_rst);
571-
lines.push_back(c_gry + "DebugControl: " + c_val + to_hex(ep->ContextRecord->DebugControl) + c_rst);
570+
lines.push_back(c_grey + "ContextFlags: " + c_white + hex_pad(ep->ContextRecord->ContextFlags, 10) + c_grey + " MxCsr: " + c_white + to_hex(ep->ContextRecord->MxCsr) + c_rst);
571+
lines.push_back(c_grey + "DebugControl: " + c_white + to_hex(ep->ContextRecord->DebugControl) + c_rst);
572572
#else
573-
lines.push_back(c_gry + "EIP: " + c_val + hex_pad(ep->ContextRecord->Eip, 10) + c_gry + " ESP: " + c_val + to_hex(ep->ContextRecord->Esp) + c_rst);
574-
lines.push_back(c_gry + "EAX: " + c_val + hex_pad(ep->ContextRecord->Eax, 10) + c_gry + " ECX: " + c_val + to_hex(ep->ContextRecord->Ecx) + c_rst);
575-
lines.push_back(c_gry + "EDX: " + c_val + hex_pad(ep->ContextRecord->Edx, 10) + c_gry + " EBX: " + c_val + to_hex(ep->ContextRecord->Ebx) + c_rst);
576-
lines.push_back(c_gry + "EBP: " + c_val + hex_pad(ep->ContextRecord->Ebp, 10) + c_gry + " ESI: " + c_val + to_hex(ep->ContextRecord->Esi) + c_rst);
577-
lines.push_back(c_gry + "EDI: " + c_val + hex_pad(ep->ContextRecord->Edi, 10) + c_gry + " EFL: " + c_val + to_hex(ep->ContextRecord->EFlags) + c_rst);
573+
lines.push_back(c_grey + "EIP: " + c_white + hex_pad(ep->ContextRecord->Eip, 10) + c_grey + " ESP: " + c_white + to_hex(ep->ContextRecord->Esp) + c_rst);
574+
lines.push_back(c_grey + "EAX: " + c_white + hex_pad(ep->ContextRecord->Eax, 10) + c_grey + " ECX: " + c_white + to_hex(ep->ContextRecord->Ecx) + c_rst);
575+
lines.push_back(c_grey + "EDX: " + c_white + hex_pad(ep->ContextRecord->Edx, 10) + c_grey + " EBX: " + c_white + to_hex(ep->ContextRecord->Ebx) + c_rst);
576+
lines.push_back(c_grey + "EBP: " + c_white + hex_pad(ep->ContextRecord->Ebp, 10) + c_grey + " ESI: " + c_white + to_hex(ep->ContextRecord->Esi) + c_rst);
577+
lines.push_back(c_grey + "EDI: " + c_white + hex_pad(ep->ContextRecord->Edi, 10) + c_grey + " EFL: " + c_white + to_hex(ep->ContextRecord->EFlags) + c_rst);
578578
#endif
579579

580580
g_tui.addException(lines);

0 commit comments

Comments
 (0)