Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Finding packet buffer...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Tue Aug 04, 2009 5:19 pm    Post subject: Finding packet buffer... Reply with quote

If I wanted to find the location of the packet buffer (before encryption) in a game how would I do that?

What I have so far would be to hook the send function and have it get me the place where it was called from the registers. Then above that code would be the encryption and the place where it got the unencrypted packets? Or would I look for an allocated region around where the function was called?

Any thoughts or experience would be helpful. I want to get some experience making packet editors and hooking functions.
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Tue Aug 04, 2009 5:33 pm    Post subject: Reply with quote

Keep tracing back the calls until you can see the decrypted buffer (pointer) in the stack before a call.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Aug 05, 2009 2:04 am    Post subject: Reply with quote

it's probably easier for you to keep tracing FORWARDS then when you see a ret, follow it and the instruction before it is the one that is calling the send. then keep going 'out' if that is a sub-routine until you find their main function. after that and before that should be the decrypt/encrypt procedures respectively
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Wed Aug 05, 2009 3:56 am    Post subject: Reply with quote

Slugsnack wrote:
it's probably easier for you to keep tracing FORWARDS then when you see a ret, follow it and the instruction before it is the one that is calling the send. then keep going 'out' if that is a sub-routine until you find their main function. after that and before that should be the decrypt/encrypt procedures respectively


Wouldnt backwards be alot easier, and make a hell lot more sense, since you have a clean stack when you're at the beginning of the function
And, the call stack might aswell be a pretty neat thing for this?
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Wed Aug 05, 2009 10:52 am    Post subject: Reply with quote

Anden100 wrote:
Slugsnack wrote:
it's probably easier for you to keep tracing FORWARDS then when you see a ret, follow it and the instruction before it is the one that is calling the send. then keep going 'out' if that is a sub-routine until you find their main function. after that and before that should be the decrypt/encrypt procedures respectively


Wouldnt backwards be alot easier, and make a hell lot more sense, since you have a clean stack when you're at the beginning of the function
And, the call stack might aswell be a pretty neat thing for this?


That's what he means. lol, he means the same thing i said.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Wed Aug 05, 2009 11:29 am    Post subject: Reply with quote

yeah but you can't 'trace backwards' so you need to find out where to start from first. which can be done with the method i described

or you could do it like pros like void which is code INLINE which means all your code is on 1 line
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Wed Aug 05, 2009 12:24 pm    Post subject: Reply with quote

Ok... I think I've got it. I will whip something up and tell you guys if it works. (Or need help...)
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Wed Aug 05, 2009 12:35 pm    Post subject: Reply with quote

Slugsnack wrote:
yeah but you can't 'trace backwards' so you need to find out where to start from first. which can be done with the method i described

or you could do it like pros like void which is code INLINE which means all your code is on 1 line
Nig, I don't code on one line what are you talking about.
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Wed Aug 05, 2009 7:06 pm    Post subject: Reply with quote

I just saw that... Do you know what you are talking about?
_________________________________________________

But onto something more important my hook isn't working and I don't know why... Could it be that they changed functions preamble in Windows 7 (what I am using)? I am also using Visual Studios 10...

Maybe compatability mode will work... I will try that now.
EDIT: Compatability mode doesn't work...

EDIT: I did some debugging the preamble is the same, I will have to figure it out later... If someone wanted to help me with my hook PM me (experienced people only).
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Thu Aug 06, 2009 2:47 am    Post subject: Reply with quote

are you sure that the function even got the preamble?
did you look at the start of the function using a debugger?
If yes, and it doesent use the preamble, you could post up the asm of the start of the function you are trying to hook, and ill have a look
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Aug 06, 2009 2:52 am    Post subject: Reply with quote

Chaosis13 wrote:
I just saw that... Do you know what you are talking about?

of course i know what i'm talking about. well at least enough to know how to successfully place hooks

anyway check whether the bytes you are replacing are the correct ones. the function you're hooking might not necessarily start with the standard setting up of the stack frame

also, write your hook code here so people can help you instead of guessing
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Aug 06, 2009 4:38 pm    Post subject: Reply with quote

Well... I just find all references to the place that called send() then trace up until the stack preservation header or in ms's case the thiscall crap. Then keep looking for references until you get a list of calls (from each game function) and that should be it.
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Thu Aug 06, 2009 5:55 pm    Post subject: Reply with quote

Ok, that makes a lot of sense, but I still can't get my hook to work...
I am using a modified version of this hook. http://theundead.atspace.com/Blog/Cplusplusssendhook.txt
I inject the DLL and it calls HookSend(), but it doesn't call SendHookFunc() when send is called.
Code:
void __declspec(naked) __stdcall  SendHookFunc()    
{
   __asm
   {
            mov  edi,edi
            push ebp
            mov ebp, esp
            mov eax, [ebp+0x08] /* Param 1 : Socket */
            mov send_s, eax
            mov eax, [ebp+0x0C] /* Param 2 : buffer */
            mov [send_buffer], eax
            mov eax, [ebp+0x10] /*Param 3 : Size*/
            mov send_sizeofdata, eax
            mov eax, [ebp+0x14] /*Param 4 : flags*/
            mov send_flags, eax
            jmp SendReturnAddress
   }
}

If I am correct I insert my code before the JMP statement like this...
Code:
void __declspec(naked) __stdcall  SendHookFunc()    
{
   __asm
   {
         mov  edi,edi
         push ebp
         mov ebp, esp
         mov eax, [ebp+0x08] /* Param 1 : Socket */
         mov send_s, eax
         mov eax, [ebp+0x0C] /* Param 2 : buffer */
         mov [send_buffer], eax
         mov eax, [ebp+0x10] /*Param 3 : Size*/
         mov send_sizeofdata, eax
         mov eax, [ebp+0x14] /*Param 4 : flags*/
         mov send_flags, eax
   }
   // My Code
   __asm   jmp SendReturnAddress
}

Any ideas?
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Thu Aug 06, 2009 6:49 pm    Post subject: Reply with quote

Try WSASend.
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Thu Aug 06, 2009 9:06 pm    Post subject: Reply with quote

Ah... *face palm* That might explain why I haven't been able to get packet editors to work. I am trying that now...

EDIT:
Problem still is unknown, although it seems as though my DLL is instantly hooked then unhooked, which could explain the problem...

EDIT:
*double face palm* I had to make a looping thread, which is better because I can activate/deactivate it. And it uses WSASend. But it works now, I will update if I find the buffer. Thanks to all that helped!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites