For*_*vin 6 c++ code-injection function-call
首先,我不想注入一个DLL.我想使用WriteProcessMemory()注入代码(如果这是可能的话).我已经使用过ReadProcessMemory()所以我认为写作并不是什么大问题.
好吧,让我们说TargetProgram.exe + D78C612有一个功能,
让我们说它可以像这样调用:
push eax
push [esp+08]
push edx
push 00
push TargetProgram.exe+AF76235
push 04
call TargetProgram.exe+D78C612
Run Code Online (Sandbox Code Playgroud)
我将如何使用WriteProcessMemory()完成此操作?
我的意思是我在哪里可以找到一个部分,我可以在其中注入我的代码而不会覆盖重要的东西.最重要的是,我该如何调用该函数?
只需在活动例程中跳转到我的代码,然后跳回并删除它?但是我怎么能找到这个例程呢?
这么多问题,我不知道如何开始...我希望你能帮助我.:)
如果你有时间我真的想看一个函数调用注入的示例代码.
您可以使用VirtualAllocEx在远程进程中分配内存,然后将您的过程复制到该内存中。
以下是进行注射的步骤:
SuspendThread(hThread); // Suspend the remote thread
remote_address = VirtualAllocEx(hProcess, ...) // allocate memory for your code
WriteProcessMemory(hProcess, remote_address, local_address, length, NULL) // copy your code to remote process
WriteProcessMemory(hProcess, remote_fixup, ...) // insert a jump to your code
ResumeThread(hThread); // Resume the remote thread
Run Code Online (Sandbox Code Playgroud)