adamhlt/Manual-DLL-Loader

GitHub: adamhlt/Manual-DLL-Loader

一个手动实现Windows DLL加载的工具库,支持从内存直接映射PE文件并获取导出函数,兼容x86和x64架构。

Stars: 96 | Forks: 24

``` __ ___ __ ____ __ __ __ __ / |/ /___ _____ __ ______ _/ / / __ \/ / / / / / ____ ____ _____/ /__ _____ / /|_/ / __ `/ __ \/ / / / __ `/ / / / / / / / / / / / __ \/ __ `/ __ / _ \/ ___/ / / / / /_/ / / / / /_/ / /_/ / / / /_/ / /___/ /___ / /___/ /_/ / /_/ / /_/ / __/ / /_/ /_/\__,_/_/ /_/\__,_/\__,_/_/ /_____/_____/_____/ /_____/\____/\__,_/\__,_/\___/_/ Custom LoadLibrary / GetProcAddress (x86 / x64) Load DLL and retrieve functions manually ```

C++ Windows x86 x64

## :open_book: 项目概述 : #### 自定义 LoadLibrary / GetProcAddress 这是对不同 Windows 函数的自定义实现: - LoadLibraryA - GetProcAddress - FreeLibrary 你可以将 DLL 手动映射到你的程序中,通过名称或序号检索函数,并释放库。 加载器执行重定位,并且完全支持 x86 和 x64 PE 映像。 加载步骤: 1. 在内存中复制 PE 映像 2. 执行重定位 3. 解析导入 (IAT) 4. 执行 TLS 回调 5. 执行 DLL 的入口点 GetFunctionAddress 也可以与通过官方 Windows 函数 LoadLibraryA 导入的库一起使用。 ## :rocket: 入门指南 ### Visual Studio 1. 打开解决方案文件 (.sln)。 2. 在 Release (x86 或 x64) 配置下构建项目 ## :test_tube: 示例 你可以像使用 LoadLibraryA 和 GetProcAddress 一样轻松导入 DLL 和函数。 ``` //Function pointer using MessageFncPtr = void (*)(); int main() { const auto lpModule = MemoryLoader::LoadDLL((LPSTR)"test.dll"); if (lpModule == nullptr) return -1; auto MessageFnc = (MessageFncPtr)MemoryLoader::GetFunctionAddress((LPVOID)lpModule, (const LPSTR)"Message"); if (MessageFnc == nullptr) return -1; MessageFnc(); MessageFnc = (MessageFncPtr)MemoryLoader::GetFunctionAddressByOrdinal((LPVOID)lpModule, 1); if (MessageFnc == nullptr) return -1; MessageFnc(); MemoryLoader::FreeDLL(lpModule); return 0; } ``` ### 测试 DLL https://user-images.githubusercontent.com/48086737/156903481-c35ad388-f8ff-49d7-9f93-dd428670d00f.mp4 ### [ImGui 独立版](https://github.com/adamhlt/ImGui-Standalone) https://github.com/adamhlt/Manual-DLL-Loader/assets/48086737/79897d57-3084-4163-9c0f-824962e1c7e5
标签:C++, DLL 注入, GetProcAddress, IAT 解析, LoadLibrary, PE 解析, x64, x86, XML 请求, 中高交互蜜罐, 云资产清单, 免杀技术, 内存加载, 动态加载, 反射式注入, 壳编程, 安全开发, 恶意软件开发, 手动映射, 数据擦除, 文件系统模拟, 暴力破解检测, 端点可见性, 系统编程, 逆向工程, 重定位表