Hook Recv问题(100分)

  • 主题发起人 主题发起人 神经蛋白质
  • 开始时间 开始时间

神经蛋白质

Unregistered / Unconfirmed
GUEST, unregistred user!
在做hook send 和 recv 的时候。<br>hook send 成功!<br>用同样的方法去hook recv,<br>但是recv得不到数据。在网上搜索了很久。得知hook Recv要在尾部进行。<br>不知道怎么在尾部来HOOK。请大虾们指教下。贴出hook recv代码!<br><br>function MySend(s: TSocket; var Buf; len, flags: Integer): Integer; stdcall;<br>var<br>&nbsp; dwSize: cardinal;<br>begin<br>&nbsp; ShowMessage('发送封包长度:'+inttostr(len));//显示发送长度 这里体现数据正确的。<br>&nbsp; WriteProcessMemory(ProcessHandle, AddSend, @OldProc[1], 8, dwSize);<br>&nbsp; Result := OldSend(S, Buf, len, flags);<br>&nbsp; JmpCode.Address := @MySend;<br>&nbsp; WriteProcessMemory(ProcessHandle, AddSend, @JmpCode, 8, dwSize);<br>end;<br><br><br><br>{---------------------------------------}<br>{函数功能:Recv函数的HOOK<br>{函数参数:同Recv<br>{函数返回值:integer<br>{---------------------------------------}<br>function MyRecv(s: TSocket; var Buf; len, flags: Integer): Integer; stdcall;<br>var<br>&nbsp; dwSize: cardinal;<br>begin<br>&nbsp; WriteProcessMemory(ProcessHandle, AddRecv, @OldProc[0], 8, dwSize);<br>&nbsp; Result := OldRecv(S, Buf, len, flags);<br>&nbsp; JmpCode.Address := @MyRecv;<br>&nbsp; WriteProcessMemory(ProcessHandle, AddRecv, @JmpCode, 8, dwSize);<br>&nbsp; ShowMessage('接收封包长度:'+inttostr(len));//这里永远不会show出来。为什么?请指点<br>end;<br><br>{------------------------------------}<br>{过程功能:HookAPI<br>{过程参数:无<br>{------------------------------------}<br>procedure HookAPI;<br>var<br>&nbsp; DLLModule: THandle;<br>&nbsp; dwSize: cardinal;<br>begin<br>&nbsp; ProcessHandle := GetCurrentProcess;<br>&nbsp; DLLModule := LoadLibrary('ws2_32.dll');<br>&nbsp; AddRecv := GetProcAddress(DLLModule, 'recv');<br>&nbsp; AddSend := GetProcAddress(DLLModule, 'send'); //取得API地址<br>&nbsp; JmpCode.JmpCode := $B8;<br>&nbsp; JmpCode.MovEAX[0] := $FF;<br>&nbsp; JmpCode.MovEAX[1] := $E0;<br>&nbsp; JmpCode.MovEAX[2] := 0;<br>&nbsp; ReadProcessMemory(ProcessHandle, AddRecv, @OldProc[0], 8, dwSize);<br>&nbsp; JmpCode.Address := @MyRecv;<br>&nbsp; WriteProcessMemory(ProcessHandle, AddRecv, @JmpCode, 8, dwSize); //修改Recv入口<br>&nbsp; ReadProcessMemory(ProcessHandle, AddSend, @OldProc[1], 8, dwSize);<br>&nbsp; JmpCode.Address := @MySend;<br>&nbsp; WriteProcessMemory(ProcessHandle, AddSend, @JmpCode, 8, dwSize); //修改Send入口<br>&nbsp; OldSend := AddSend;<br>&nbsp; OldRecv := AddRecv;<br>end;
 
如何才能得到recv的封包数据呢?
 
怎么没人
 
这种东西找小白吧! 小白对这种很有研究
 
如何找到其人!!
 
http://www.delphibbs.com/delphibbs/dispq.asp?lid=3830842<br><br>进他的群吧! 里面很多牛人. 相信你的问题得到解决
 

Similar threads

后退
顶部