HollowsHunter
Scans all running processes. Recognizes and dumps a variety of potentially malicious implants (replaced/implanted PEs, shellcodes, hooks, in-memory patches).
Loading...
Searching...
No Matches
term_util.cpp
Go to the documentation of this file.
1
#include "
term_util.h
"
2
3
#include <windows.h>
4
5
#include <iostream>
6
#include <string>
7
#include <mutex>
8
#include <paramkit.h>
9
10
std::mutex
g_stdOutMutex
;
11
12
bool
hh::util::get_current_color
(
int
descriptor, WORD &color)
13
{
14
HANDLE hConsole = GetStdHandle(descriptor);
15
if
(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL) {
16
return
false
;
17
}
18
return
paramkit::get_console_color(hConsole, color);
19
}
20
21
WORD
hh::util::set_color
(WORD color)
22
{
23
WORD old_color = 7;
24
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
25
if
(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL) {
26
return
old_color;
27
}
28
if
(paramkit::get_console_color(hConsole, old_color)) {
29
SetConsoleTextAttribute(hConsole, color);
30
}
31
return
old_color;
32
}
33
34
void
hh::util::print_in_color
(WORD color,
const
std::string &text)
35
{
36
const
std::lock_guard<std::mutex> stdOutLock(
g_stdOutMutex
);
37
paramkit::print_in_color(color, text);
38
}
hh::util::get_current_color
bool get_current_color(int descriptor, WORD &color)
Definition
term_util.cpp:12
hh::util::print_in_color
void print_in_color(WORD color, const std::string &text)
Definition
term_util.cpp:34
hh::util::set_color
WORD set_color(WORD color)
Definition
term_util.cpp:21
g_stdOutMutex
std::mutex g_stdOutMutex
Definition
term_util.cpp:10
term_util.h
Generated by
1.16.1