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 


[Other]Saving an Executable file

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
vergilganesh
Expert Cheater
Reputation: 0

Joined: 01 Jul 2013
Posts: 134
Location: India

PostPosted: Sun Sep 29, 2013 6:50 am    Post subject: [Other]Saving an Executable file Reply with quote

Is there any software to save the .exe file after applying cheats?? I tried Ollydbg but i dont know how to do that? is it possible? because i m too lazy to open cheat engine or trainer every time i open a game.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
_Veggy
Cheater
Reputation: 2

Joined: 30 Apr 2013
Posts: 34
Location: BReWErS rox your dox

PostPosted: Sun Sep 29, 2013 8:38 am    Post subject: Reply with quote

When you use cheatengine to generate the code caves, it allocates memory.
When dumping the exe normally the allocated memory isn't there so you need to dump the allocated memory aswell and apply it to the .exe using any PE modifying tools.
Easiest would be if you would create the codecaves inside the .exe.
Find some free space inside the .exe, patch the game and save executable.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25776
Location: The netherlands

PostPosted: Sun Sep 29, 2013 8:53 am    Post subject: Re: [Other]Saving an Executable file Reply with quote

vergilganesh wrote:
i m too lazy to open cheat engine or trainer every time i open a game.

Why don't you make a trainer that launches the game for you ?

_________________
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
View user's profile Send private message MSN Messenger
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 340
Location: Somewhere....

PostPosted: Sun Sep 29, 2013 8:53 am    Post subject: Re: [Other]Saving an Executable file Reply with quote

vergilganesh wrote:
I tried Ollydbg but i dont know how to do that?.


in Ollydbg, change the assembly line you want, then right click on it, select:
"Copy To Executable"--->"All" , or "Selection", another window appears with the hex dump of the file, close it, then a message box appears to tell about file modification, save the file with a new name(recommended), done.
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Sun Sep 29, 2013 12:22 pm    Post subject: Reply with quote

...Or if your hacks are only made of auto assembler scripts, you may be able to turn them into hardcodable hacks (remember that CE can also be used as a file patcher), however it's a bit more complex that regular AA scripts:
-You can't use module addressing (like jmp game.exe+1234) because there is no module in a file.
-For the same reason you can't use aobscanmodule, use the basic aobscan instead.
-Don't include bytes you'll modify in your aob signatures (or you won't be able to remove your hacks for the file.exe).
-You can't use constant addressing (like 401123: ) to place your code because addresses in files and addresses in a running process (called Virtual Addresses, or VA) are completely different. You can use constant addressing to refer static data (like mov eax,[450000] ) if and only if your target doesn't use ASLR.
-You can't use alloc/dealloc/globalalloc since those are meaningless in a file. Instead use the huge code cave at the end of the memory region that contains the game's code. Use memory viewer->view->memory regions to find where that memory region ends... Or scan for a lot of zeros in an executable, non writable region, and pick the first result after the code you modify.
-If you need to declare variables for you hack, hijack the last bytes of a writable memory region, and refer to it via constant addressing (if you can). DO NOT put it in the cave that contains your code or you'll get an access violation.

Ok so after the "Don't"s here are the "Do"s:
-Putting constants that you'll only read after your code is fine and recommended.
-Everytime you want to refer to a piece of the original code you need to locate it via an aobscan.
-When you have short jumps (they take only 2 bytes) it's simpler to put them in the db xx xx form (with a comment) rather than aobscanning their destination.
-Jumps and calls that have their destination in code you created work as usual.
-Long jumps and calls in the disable section should be in db xx xx xx xx xx form.

Example of a bigass hardcodable hack: http://forum.cheatengine.org/viewtopic.php?t=566147&start=47
I said it must be hardcoded, but it can be applied on a running process too, it's just that it'll be too late since it patches the game's startup.

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Sep 29, 2013 1:37 pm    Post subject: Reply with quote

If I were wanting to make a permanent fix, I would use Ollydbg, find a suitable code cave and rewrite my scripts to work with the .exe as a standalone.

If you're just lazy, as you say, do as others have suggested...DB's advice is probably the fastest.
Back to top
View user's profile Send private message
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 340
Location: Somewhere....

PostPosted: Sun Sep 29, 2013 2:14 pm    Post subject: Reply with quote

also you can add an extra empty code section to the app(in case you're code cave is big, or you can't find a ZEROed spot in the exe), best app to use is CFF Explorer, make sure to test exe after adding section, also don't forget updating header data.
Back to top
View user's profile Send private message
vergilganesh
Expert Cheater
Reputation: 0

Joined: 01 Jul 2013
Posts: 134
Location: India

PostPosted: Mon Sep 30, 2013 12:50 am    Post subject: Reply with quote

I tried using Ollydbg but i got a problem. I cant save more than one changes. There is only one option in "copy to executables --> selection".



I have many questions.
1. I have not found any options like "copy to executables ---> all". If i save under selection only selected changes are saved not all.

2. Is there any possible way to allocate memory just above or below an instruction to do code injection in ollydbg?

3. What are the other tools that are easy to handle and patch the .exe into new one?

4. If the written code is less than the size of original code i filled them with nops. what if the original code is less in size?

_________________
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 340
Location: Somewhere....

PostPosted: Mon Sep 30, 2013 3:19 am    Post subject: Reply with quote

vergilganesh wrote:
I tried using Ollydbg but i got a problem. I cant save more than one changes. There is only one option in "copy to executables --> selection"

1. I have not found any options like "copy to executables ---> all". If i save under selection only selected changes are saved not all.

you can use CTRL+G to move from an instruction to another, edit it, then go to next one, at then the "All modification" is found under the "Copy to executable" menu, just leave the hex dump dialog opened till you finished all modifications., if still not shown, then mark each edited blocks (as you did in the picture), then use "Selection" for each block.

2. Is there any possible way to allocate memory just above or below an instruction to do code injection in ollydbg?
yes it's possible, but i guess it need plugins, however, these are memory virtually allocated, and not code sections stored to the file

3. What are the other tools that are easy to handle and patch the .exe into new one?
any hex editor for quick patching bytes, or CFF Explorer for pe arranging or code sections modifications are good.

4. If the written code is less than the size of original code i filled them with nops. what if the original code is less in size?
if you are going to patch it permanently, why would you care about this?, if you plan to revert it(say with a trainer), you will need to restore all original bytes again, including those taken by the long patched bytes.
Back to top
View user's profile Send private message
vergilganesh
Expert Cheater
Reputation: 0

Joined: 01 Jul 2013
Posts: 134
Location: India

PostPosted: Mon Sep 30, 2013 9:31 am    Post subject: Reply with quote

there is no options like "all modifications"



i have changed 3 codes continuously but there is no options available. In version 2.0 there is no copy to executable options.

These three are nearest so it is easy to select individually. But my codes are far distance from each one.


pls Name that plugin because i have lot of em in a site.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 340
Location: Somewhere....

PostPosted: Mon Sep 30, 2013 11:26 am    Post subject: Reply with quote

vergilganesh wrote:
These three are nearest so it is easy to select individually. But my codes are far distance from each one.


Told you, use CTRL+G keys, type the address, then go and mark the block, like in the pic, that would be the current "Selection", or for version two like i use...

for the plugin, Olly Advanced, this one can do memory allocations (but i don't know if it works with v2 of Olly, only v1.10 was tested).



qqqqzzzz.png
 Description:
 Filesize:  63.35 KB
 Viewed:  37484 Time(s)

qqqqzzzz.png


Back to top
View user's profile Send private message
vergilganesh
Expert Cheater
Reputation: 0

Joined: 01 Jul 2013
Posts: 134
Location: India

PostPosted: Tue Oct 01, 2013 2:42 am    Post subject: Reply with quote

Yes i saved total by using "Shift+End" keys. But i m unable to allocate memory. The application ends at 007386FFF. Cheat engine generates memory after this instruction/address. I can do code injection by using jmp instruction manually if i allocate some memory for my code. How to allocate memory. I googled and i cant findout anything.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Oct 01, 2013 6:20 am    Post subject: Reply with quote

You can add a new section. You can use StudPE. Be sure you have set MEM_EXECUTE, MEM_READ and MEM_WRITE flags.
_________________
Back to top
View user's profile Send private message MSN Messenger
vergilganesh
Expert Cheater
Reputation: 0

Joined: 01 Jul 2013
Posts: 134
Location: India

PostPosted: Tue Oct 01, 2013 7:34 am    Post subject: Reply with quote

using stud_pe i can add new section. But the code i wrote is 005xxxxx and the section i added is starts at 02f0xxxx. Then how do i save the file. because both are at different sections of memory. using ctrl+g i can go to one address and mark that block., then after pressing crtl+g thn typing address i m unable to select next particular block. I have not any copy to executable--> all modifications options. I have done what you said as it is. There is no option there.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TsTg
Master Cheater
Reputation: 5

Joined: 12 Dec 2012
Posts: 340
Location: Somewhere....

PostPosted: Tue Oct 01, 2013 12:42 pm    Post subject: Reply with quote

rewrite your code cave at 02f0xxxx, and do jmp 02f0xxxx from original code location, then save the file.
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