From 813e464a2f7a6ebfe073b1cade577f9f803ae700 Mon Sep 17 00:00:00 2001 From: auth12 <67507608+auth12@users.noreply.github.com> Date: Tue, 6 Jul 2021 23:21:34 +0100 Subject: Replaced create thread with thread hijacking --- sysmap/src/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'sysmap/src/main.cpp') diff --git a/sysmap/src/main.cpp b/sysmap/src/main.cpp index 4c73340..d775e6c 100644 --- a/sysmap/src/main.cpp +++ b/sysmap/src/main.cpp @@ -24,17 +24,20 @@ int main(int argc, char* argv[]) { if (args.size() < 2) { io::log("Invalid arguments specified."); + std::cin.get(); + return 0; } - spdlog::set_pattern("[%^%l%$] %v"); - for (auto& arg : args) { if (arg == "--debug") { spdlog::set_level(spdlog::level::debug); } } + spdlog::set_pattern("[%^%l%$] %v"); + spdlog::set_level(spdlog::level::debug); + g_ctx.local_modules = std::move(util::get_modules()); auto ntdll = g_ctx.local_modules[1]; @@ -45,13 +48,21 @@ int main(int argc, char* argv[]) { io::log("waiting for {}", args[0]); + auto buf = io::read_file(args[1]); + if (buf.empty()) { + io::log("failed to read file."); + std::cin.get(); + + return 0; + } + process::process_x64_t proc; if (NT_SUCCESS(proc.attach(args[0]))) { io::log("attached!"); proc.modules = proc.get_modules(); - proc.map(io::read_file(args[1])); + proc.map(buf); proc.close(proc.handle); } -- cgit v1.2.3