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 


Help with code injection tutorial 8! revised question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Thu Aug 05, 2010 1:35 pm    Post subject: Help with code injection tutorial 8! revised question Reply with quote

How to solve cheat engine tutorial 8 with code injection

my steps

1)Found value
2)Memory on write

Original code
Code:

mov [ebx+18],edi
lea edx,[ebp-04]


My codes
Code:

mov [ebx+18],1388  //1388 == 5000d
lea edx,[ebp-04]


But not working


Last edited by Freiza on Fri Aug 06, 2010 2:32 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Thu Aug 05, 2010 6:39 pm    Post subject: Reply with quote

Step 8 is about multi-level pointers.
Step 7 is code injection.

Task:

Code injection is a technique where one injects a piece of code into the target process, and then reroute the
execution of code to go through your own written code

In this tutorial you'll have a health value and a button that will decrease your health with 1 each time you click it.
Your task is to use code injection to increase the value of your health with 2 every time it is clicked

Working script:

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)

0045A063:
jmp newmem
nop
returnhere:

newmem:
add [ebx+00000310],2

originalcode:
//dec [ebx+00000310]

exit:
jmp returnhere

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
0045A063:
dec [ebx+00000310]
//Alt: db FF 8B 10 03 00 00

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 892

PostPosted: Thu Aug 05, 2010 8:08 pm    Post subject: Reply with quote

The problem is that you're looking at a value at the end of the pointer chain. When you hit the "change pointer" button, it no longer points to the value being compared to 5000. If you wanna' hack it by injection, you wanna' look for the code that compares against the constant 5000. In a "real-world" application, where you didn't know what condition was allowing success, you'd probably instead spy on the (well known) API calls to manipulate common controls - enablewindow to set the next button to active, setwindowtext to change the static text control, etc.

Cheers,
adude

Code:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)
label(address)
registersymbol(address)

Tutorial.exe+59B6F:
jmp newmem
nop
nop
returnhere:

newmem: //this is allocated memory, you have read,write,execute access
//place your code here
push ecx //grab the address
lea ecx,[eax+18] //not required for this hack
mov [address],ecx //but probably answers
pop ecx //the inevitable next question
mov [eax+18],#5000
originalcode:
cmp [eax+18],00001388
exit:
jmp returnhere
address:
dd 0
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
unregistersymbol(address)
Tutorial.exe+59B6F:
cmp [eax+18],00001388
//Alt: db 81 78 18 88 13 00 00
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Fri Aug 06, 2010 1:39 am    Post subject: Mr. Geri. You are getting me wrong. Reply with quote

To Geri:
Dear, I was trying to solve tutorial 8 with code injection. I do know it is multilevel pointer.

Mr. Justa_dude got me right.

To Justa_dude:
Any ways how did you reach to Tutorial.exe+59B6F.

I did both memory on write and memory on access but always break at

00459862 - 89 7b 18 - mov [ebx+18],edi
Back to top
View user's profile Send private message Send e-mail
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Fri Aug 06, 2010 4:37 am    Post subject: Reply with quote

Oh I see. I was totally confused. Rolling Eyes
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 892

PostPosted: Fri Aug 06, 2010 8:24 am    Post subject: Re: Mr. Geri. You are getting me wrong. Reply with quote

freiza wrote:

Any ways how did you reach to Tutorial.exe+59B6F.

I did both memory on write and memory on access but always break at

00459862 - 89 7b 18 - mov [ebx+18],edi

I cheated. I knew that the tutorial was comparing the value against 5000, so I looked for that compare. That's related to what I was saying earlier - in a "real" app, you'd probably wanna' set a breakpoint on setwindowtext or sprintf or something else to try to find the value. The searches you're using aren't working because they only find the pointers that become invalid when you click the "change pointer" button.

TBH, this isn't the best example of a case where you'd grab a pointer via. injection. In a real game, the pointers would likely only be reset when you load a new level or die or something significant - you're not going to be concerned with what their values are AFTER they change but before the event that triggers your injection happens again (i.e., what your health is while you're loading a new level).

Cheers,
adude
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 Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
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