From 87ebe513f89730d61a0e7fd0e48d0fea4e6def77 Mon Sep 17 00:00:00 2001 From: qtKite Date: Thu, 3 Jun 2021 16:09:30 +1000 Subject: [PATCH] changed indentation --- src/defender-control/dcontrol.cpp | 16 ++-- src/defender-control/main.cpp | 2 +- src/dumper/dumper.cpp | 154 +++++++++++++++--------------- 3 files changed, 86 insertions(+), 86 deletions(-) diff --git a/src/defender-control/dcontrol.cpp b/src/defender-control/dcontrol.cpp index a6b7d00..0198858 100644 --- a/src/defender-control/dcontrol.cpp +++ b/src/defender-control/dcontrol.cpp @@ -2,17 +2,17 @@ namespace DCONTROL { - bool enable_control() - { + bool enable_control() + { - return true; - } + return true; + } - bool disable_control() - { + bool disable_control() + { - return true; - } + return true; + } } \ No newline at end of file diff --git a/src/defender-control/main.cpp b/src/defender-control/main.cpp index b68fc93..8a44ad6 100644 --- a/src/defender-control/main.cpp +++ b/src/defender-control/main.cpp @@ -9,5 +9,5 @@ int main() { - return 0; + return 0; } diff --git a/src/dumper/dumper.cpp b/src/dumper/dumper.cpp index 3fe1eef..2edb07f 100644 --- a/src/dumper/dumper.cpp +++ b/src/dumper/dumper.cpp @@ -22,102 +22,102 @@ namespace RegHooks { - using regenumvaluew_t = LSTATUS(*)(HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD); - uintptr_t regenumvaluew_addr; - - // hook for RegEnumValueW - // ms docs: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regenumvaluew - // - LSTATUS hk_regenumvaluew( - HKEY hKey, - DWORD dwIndex, - LPWSTR lpValueName, - LPDWORD lpcchValueName, - LPDWORD lpReserved, - LPDWORD lpType, - LPBYTE lpData, - LPDWORD lpcbData - ) - { - auto original = reinterpret_cast(regenumvaluew_addr) - (hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData); - - std::cout << "hk_reg_enum_valuew(" << hKey << ", " << dwIndex << ", " << lpValueName << ", " - << ", " << lpcchValueName << ", " << lpReserved << ", " << lpType << ", " << - ", " << lpData << ", " << lpcbData << ");" << std::endl; - - return original; - } + using regenumvaluew_t = LSTATUS(*)(HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD); + uintptr_t regenumvaluew_addr; + + // hook for RegEnumValueW + // ms docs: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regenumvaluew + // + LSTATUS hk_regenumvaluew( + HKEY hKey, + DWORD dwIndex, + LPWSTR lpValueName, + LPDWORD lpcchValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData + ) + { + auto original = reinterpret_cast(regenumvaluew_addr) + (hKey, dwIndex, lpValueName, lpcchValueName, lpReserved, lpType, lpData, lpcbData); + + std::cout << "hk_reg_enum_valuew(" << hKey << ", " << dwIndex << ", " << lpValueName << ", " + << ", " << lpcchValueName << ", " << lpReserved << ", " << lpType << ", " << + ", " << lpData << ", " << lpcbData << ");" << std::endl; + + return original; + } } namespace DetourExample { - using LoadStr_t = int(*)(HINSTANCE, UINT, LPSTR, int); - uint64_t loadstr_addr; - - int __stdcall hk_loadstr(HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int cchBufferMax) - { - auto original = ((LoadStr_t)(loadstr_addr))(hInstance, uID, lpBuffer, cchBufferMax); - return original; - } - - // only to serve as a temp example, do not call - void example_hook() - { - // perform hooking - loadstr_addr = (uint64_t)GetProcAddress(GetModuleHandleA("User32.dll"), "LoadStringA"); - DetourTransactionBegin(); - DetourUpdateThread(GetCurrentThread()); - DetourAttach(&(PVOID&)loadstr_addr, hk_loadstr); - DetourTransactionCommit(); - } + using LoadStr_t = int(*)(HINSTANCE, UINT, LPSTR, int); + uint64_t loadstr_addr; + + int __stdcall hk_loadstr(HINSTANCE hInstance, UINT uID, LPSTR lpBuffer, int cchBufferMax) + { + auto original = ((LoadStr_t)(loadstr_addr))(hInstance, uID, lpBuffer, cchBufferMax); + return original; + } + + // only to serve as a temp example, do not call + void example_hook() + { + // perform hooking + loadstr_addr = (uint64_t)GetProcAddress(GetModuleHandleA("User32.dll"), "LoadStringA"); + DetourTransactionBegin(); + DetourUpdateThread(GetCurrentThread()); + DetourAttach(&(PVOID&)loadstr_addr, hk_loadstr); + DetourTransactionCommit(); + } } namespace DetourHelper { - // places a hook - void perf_hook() - { - // example code from last ctf - // will add code base for x64 and x32 support, as well as setup empty - // project to do this stuff quicky? - } - - // removes a hook - void undo_hook() - { - - } + // places a hook + void perf_hook() + { + // example code from last ctf + // will add code base for x64 and x32 support, as well as setup empty + // project to do this stuff quicky? + } + + // removes a hook + void undo_hook() + { + + } } void thread_main() { - // setup console - // - AllocConsole(); - freopen("CONIN$", "r", stdin); - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); - SetConsoleTitleA("Log"); + // setup console + // + AllocConsole(); + freopen("CONIN$", "r", stdin); + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + SetConsoleTitleA("Log"); } BOOL APIENTRY DllMain(HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved + DWORD ul_reason_for_call, + LPVOID lpReserved ) { - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - CreateThread(0, 0, reinterpret_cast(thread_main), 0, 0, 0); - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + CreateThread(0, 0, reinterpret_cast(thread_main), 0, 0, 0); + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; }