 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
spyware293 Newbie cheater
Reputation: 0
Joined: 28 Jun 2012 Posts: 13
|
Posted: Thu Jun 28, 2012 11:17 am Post subject: [C++] Intercept send hook |
|
|
| i create a dll that hook to send() function of a game client. now im able to log the packets, but i want to know how to change what my client send. (e.g if client send A then output is send C, if client send D then output is send B) btw, im using detours
|
|
| Back to top |
|
 |
Innovation Grandmaster Cheater
Reputation: 12
Joined: 14 Aug 2008 Posts: 617
|
Posted: Thu Jun 28, 2012 12:15 pm Post subject: |
|
|
| What's your code?
|
|
| Back to top |
|
 |
spyware293 Newbie cheater
Reputation: 0
Joined: 28 Jun 2012 Posts: 13
|
Posted: Thu Jun 28, 2012 12:48 pm Post subject: |
|
|
| Code: | #pragma comment(lib, "Ws2_32.lib")
#undef UNICODE
typedef int (WINAPI *SendPtr)(SOCKET s, const char* buf, int len, int flags);
HMODULE hLib = LoadLibrary("ws2_32.dll");
SendPtr pSend = (SendPtr)GetProcAddress(hLib, "send");
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags);
INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
{
switch(Reason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hDLL);
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)pSend, MySend);
break;
case DLL_PROCESS_DETACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{
return pSend(s, buf, len, flags);
} |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25819 Location: The netherlands
|
Posted: Thu Jun 28, 2012 1:48 pm Post subject: |
|
|
Just do you r filter in your MySend function
e.g:
instead of
| Code: |
return pSend(s, buf, len, flags);
|
do:
| Code: |
if (buf[0]==0xgg)
buf[0]=0xhh;
return pSend(s, buf, len, flags);
|
Or copy the buffer first and change that and then pass that copy to pSend instead of the original
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
spyware293 Newbie cheater
Reputation: 0
Joined: 28 Jun 2012 Posts: 13
|
Posted: Thu Jun 28, 2012 8:18 pm Post subject: |
|
|
i've tried this
| Code: | if (buf[0]==0x01)
{
buf[0]=0x02;
MessageBox(HWND_DESKTOP,"TEST","TEST",MB_OK);
return pSend(s, buf, len, flags);
}
else
return pSend(s, buf, len, flags); |
but when i tried to sent a packet which contain 01, it doesn't trigger the filter even the messagebox didn't pop up
|
|
| Back to top |
|
 |
spyware293 Newbie cheater
Reputation: 0
Joined: 28 Jun 2012 Posts: 13
|
Posted: Fri Jun 29, 2012 4:10 pm Post subject: |
|
|
haha thx dark byte, my problem is solved
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|