diff options
| author | auth12 <[email protected]> | 2020-07-27 09:46:17 -0700 |
|---|---|---|
| committer | auth12 <[email protected]> | 2020-07-27 09:46:17 -0700 |
| commit | a2e89fde1acc5b189c55e0b8b38146194e455cd0 (patch) | |
| tree | 1f130027975733e0704a583aebb1a1832a22ec11 /client/src/util/util.cpp | |
| parent | Compile fix. (diff) | |
| download | loader-a2e89fde1acc5b189c55e0b8b38146194e455cd0.tar.xz loader-a2e89fde1acc5b189c55e0b8b38146194e455cd0.zip | |
Removed spdlog, using fmt wrapper instead.
More process class changes, support for 32/64bit processes.
Injection process improvements.
Other small changes.
Diffstat (limited to 'client/src/util/util.cpp')
| -rw-r--r-- | client/src/util/util.cpp | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/client/src/util/util.cpp b/client/src/util/util.cpp index b79f6cd..1847780 100644 --- a/client/src/util/util.cpp +++ b/client/src/util/util.cpp @@ -3,8 +3,6 @@ #include "io.h" #include "syscalls.h" -std::unordered_map<std::string, pe::virtual_image> util::loaded_modules; - std::string util::wide_to_multibyte(const std::wstring& str) { std::string ret; size_t str_len; @@ -40,36 +38,9 @@ std::wstring util::multibyte_to_wide(const std::string& str) { return out; } - -native::_PEB* util::cur_peb() { - return reinterpret_cast<native::_PEB*>(__readgsqword(0x60)); -} - -bool util::init() { - auto peb = cur_peb(); - if (!peb) return false; - - if (!peb->Ldr->InMemoryOrderModuleList.Flink) return false; - - auto* list = &peb->Ldr->InMemoryOrderModuleList; - - for (auto i = list->Flink; i != list; i = i->Flink) { - auto entry = CONTAINING_RECORD(i, native::LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks); - if (!entry) - continue; - - auto name = wide_to_multibyte(entry->BaseDllName.Buffer); - std::transform(name.begin(), name.end(), name.begin(), ::tolower); - - loaded_modules[name] = pe::virtual_image(entry->DllBase); - } - - return true; -} - bool util::close_handle(HANDLE handle) { if (!handle) { - io::logger->error("invalid handle specified to close."); + io::log_error("invalid handle specified to close."); return false; } @@ -77,7 +48,7 @@ bool util::close_handle(HANDLE handle) { auto status = nt_close(handle); if (!NT_SUCCESS(status)) { - io::logger->error("failed to close {}, status {:#X}.", handle, (status & 0xFFFFFFFF)); + io::log_error("failed to close {}, status {:#X}.", handle, (status & 0xFFFFFFFF)); return false; } |