| View previous topic :: View next topic |
| Author |
Message |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Wed Feb 11, 2009 9:22 pm Post subject: [C++] Send Hook |
|
|
| Code: | SOCKET pSocket = NULL;
DWORD Sendaddr = NULL;
DWORD SendJmp = NULL;
DWORD OldProtection;
//---------------------------------------------------------------------------
void __declspec(naked) __stdcall SendHook()
{
__asm
{
mov edi,edi
push ebp
mov ebp, esp
push [ebp+0x08]
push [ebp+0x0C]
call LogHandler
jmp SendJmp
}
}
void __stdcall LogHandler( char* buf, SOCKET sock ) { // cut rapion said so
pSocket = sock;
//Log buf here
return;
}
void HookHandler( bool isHook ) {
if( isHook ) {
Sendaddr = (DWORD)GetProcAddress( LoadLibrary( "ws2_32.dll" ), "send" );
SendJmp = Sendaddr + 5;
VirtualProtect( &Sendaddr, 0x05, PAGE_READWRITE , &OldProtection );
*(BYTE*)Sendaddr = 0xe9;
*(int*)(Sendaddr+1) = JMP( Sendaddr, (DWORD*)SendHook );
}
if( !isHook ) {
*(WORD*)Sendaddr = 0xFF8B;
*(BYTE*)(Sendaddr+2) = 0x55;
*(WORD*)(Sendaddrs+3) = 0xEC8B;
VirtualProtect( &Sendaddr, 0x05, OldProtection, &OldProtection );
}
}
|
Last edited by slippppppppp on Fri Feb 13, 2009 5:10 pm; edited 1 time in total |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Feb 11, 2009 9:39 pm Post subject: |
|
|
Um... what about it? _________________
|
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Wed Feb 11, 2009 9:41 pm Post subject: |
|
|
Maybe its better in a script bin? _________________
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Wed Feb 11, 2009 9:42 pm Post subject: |
|
|
| Maybe some people may want to know how to hook send or just hook in general? |
|
| Back to top |
|
 |
AlbanainRetard Master Cheater
Reputation: 0
Joined: 02 Nov 2008 Posts: 494 Location: Canada eh?
|
Posted: Wed Feb 11, 2009 9:44 pm Post subject: |
|
|
| slippppppppp wrote: | | Maybe some people may want to know how to hook send or just hook in general? |
I am not attacking you, and thus will not get into a flame war.
@offtopic
There are tutorials on this. _________________
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Wed Feb 11, 2009 9:48 pm Post subject: |
|
|
| I know, but most tutorials use the Detours lib, this doesnt |
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Feb 11, 2009 11:39 pm Post subject: |
|
|
... what is the point of posting this other than to say: "Oh look at what I can do!"
This isn't even a tutorial, it's a posted source sample that doesn't even have commenting. Please find some other forum to attempt to boost your ego.
[Edit: My bad, it seems there is ONE whole comment that I seem to have overlooked.] |
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Thu Feb 12, 2009 5:46 am Post subject: |
|
|
Pretty nice code actually , thanks! |
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Feb 12, 2009 8:33 am Post subject: |
|
|
| __inline plz. |
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Thu Feb 12, 2009 1:34 pm Post subject: |
|
|
| Fail. The function "LogHandler" must be __stdcall because it has to clean up the stack. Visual C++ default calling convention is __cdecl. That hook will crash as soon as Send() is called. |
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Thu Feb 12, 2009 8:59 pm Post subject: |
|
|
| Apparently it doesnt crash. |
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Fri Feb 13, 2009 1:45 pm Post subject: |
|
|
| slippppppppp wrote: | | Apparently it doesnt crash. |
Then your default calling convention is set to __stdcall. If someone else's was set to something else, it would crash. |
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
|
| Back to top |
|
 |
the_undead Expert Cheater
Reputation: 1
Joined: 12 Nov 2006 Posts: 235 Location: Johannesburg, South Africa
|
Posted: Tue Jun 12, 2012 9:32 am Post subject: |
|
|
haha. didn't even ever realize this. oddly similar to my code. hmm. _________________
|
|
| Back to top |
|
 |
|