我正在寻找如何注入一个DLL到程序(EXE,或DLL等)。我一直在googleing dll注入,但我还没有发现任何非常有用的:(我没有与dll工作非常多,所以我不知道该怎么办,我真的可以在这方面使用一些帮助。我唯一真正发现的是setwindowshookex,但我找不到任何例子,我不知道如何使用它。任何问题只是问,我会尽力帮助。是谷歌搜索,这看起来像一些关于DLL注入值得一看,但我不能让代码运行:\(How to hook external process with SetWindowsHookEx and WH_KEYBOARD)如何使用dll注入?
0
A
回答
0
我最熟悉的方法是w如Jefferey Richter在Programming Applications for Microsoft Windows中所述。我提到这一点,因为即使你没有亲手书本身,也可能有浮动的示例代码。我想他可能也写了一些期刊文章。他还提到了一些替代方法,其中我将只从内存中描述一种方法。他也可能写了一些相关的MSJ/MSDN文章。
无论如何,基本的想法是导致您想要加载DLL的进程发出致电LoadLibrary
的进程。这是通过使用CreateRemoteThread
来完成的,地址为LoadLibary
,对于lpStartAddress
以及命名您的DLL的字符串地址为lpParameter
。安排和定位字符串是通过使用VirtualAllocEx
在远程进程中分配一些内存,并使用WriteProcessMemory
来填充字符串。
伪代码:
void InjectDllIntoProcess(DWORD processId, char *dllName)
{
HANDLE hRemoteProcess = OpenProcess(
// Assumes that dll and function addresses are the same in different processes
// on the same system. I think that this is true even with ASLR, only issue I
// can think of is to make sure that the source and target process are both 32
// or both 64 bit, not a mixture.
// Note that it is asking for the ASCII version
HMODULE hDll = LoadLibrary(_T("Kernel32.dll"));
void *loadLibAddr = GetProcAddress(hDll, _T("LoadLibraryA"));
// Inject the DLL name
char * remoteAddr =
(char *)VirtualAllocEx(hRemoteProcess, NULL, strlen(dllName) + 1, ...
WriteProcessMemory(hRemoteProcess, remoteAddr, dllName, strlen(dllName) + 1 ...
CreateRemoteThread(hRemoteProcess, ??, 0, loadLibAddr, remoteAddr, ...
}
相关问题
- 1. 使用C的dll注入
- 2. C#Dll注入器,VB.Net Dll注入器
- 3. DLL注入用CreateRemoteThread
- 4. 用createremotethread注入dll
- 5. SetWinEventHook - Dll注入?
- 6. 注入C++ DLL
- 7. 注入DLL何时开始?
- 8. 如何使用Inno Setup注册.NET DLL
- 9. 如何使用MSBuild注册DLL
- 10. 使用DLL注入Asm to C++
- 11. 使用什么技术来注入DLL?
- 12. 如何避免easyhook多次注入dll?
- 13. 如何找到注入的hook dll?
- 14. 如何使用Blackllist /通过唯一标识dll来阻止dll注入?
- 15. DLL注入失败
- 16. 卸载注入DLL
- 17. DLL注入war3的
- 18. '安全'DLL注入
- 19. DLL注入代码
- 20. 托管DLL注入?
- 21. 防止DLL注入从DLL C++
- 22. Autofac注册DLL使用Assembly.Load
- 23. 注册.dll使用regsvr32
- 24. 使用WIX注册C#DLL
- 25. 如何在Sharepoint注册DLL?
- 26. DLL注入器问题
- 27. 注入DLL不正确HMODULE
- 28. DLL注入| GetProcAddress返回NULL
- 29. C++,Winsocket DLL发送注入
- 30. Java运行时DLL注入
确定,所以如果它加载我的DLL它将运行我的代码,如果它是它自己的? – blood 2010-05-02 01:05:09
它只会加载库。这确实意味着它会调用DLL的DllMain进行初始化。从那里你可以做任何你需要的其他安排。一旦LoadLibrary调用返回,您创建的用于调用LoadLibrary的线程将会死亡。 – torak 2010-05-02 01:12:37
嗯不错xD这也是这本书里的所有内容吧? http://www.amazon.com/Programming-Applications-Microsoft-Windows-General/dp/1572319968 我可能会购买它,如果它具有所有这一切,它还有什么? – blood 2010-05-02 01:14:46