Cheat Engine Dll Inject

0 views
Skip to first unread message

Sourabh Doherty

unread,
Aug 4, 2024, 11:57:14 PM8/4/24
to icelatar
inDisassembler, there is "Tools - Dissect Code" (Ctrl-J), which analyzes the source code of the game. After running that, the normal disassembler displays more informations, for example which addresses are calling a function. Double-clicking on one of these addresses lets the Disassembler jump to this location.

if your address list contains an adress resulting from some pointers, you cannot directly copy the address itself. Make a right-click on this address and invoke "Pointer Scan for this address. In the pointer scanner window you can easily copy the address and close the pointer scanner.


as you most likely now, pressing Ctrl-H on a table entry lets you set Hotkeys. Default is to check/uncheck the freeze-Box. But you can also set the hotkey to increase/decrease the value by a specific amount. So "get 1000$ ingame" does not require any scripting.


sometimes you have a table entry "full health" and an entry "current health". Of course you want to copy full to current. Instead of writing a script, you can freeze current health and set the value(!) of current health to (full health). Now the content of "full health" is copied to current health. Got this hint from DarkByte/Eric himself on the forums which shall not be named in a thread which has been deleted there.


well I discovered that when you try to break and trace vcruntime140 like with unreal games you have to leave the skip system

modules box unchecked or it won't work! Also leave stay inside initial module unchecked as well to capture everything or you will only get a few instructions captured! (Info by JoseFaction)


Another thing that's handy but many people don't know: If you use "find out what addresses this code accesses" on a 'ret' instruction, it'll return the addresses of the functions that called the function you're in (Info by Eric/DarkByte)


after copying an address with a code injection and save the wanted address as "playerbase", do not use [playerbase] in the address entries which use it. Instead, make a pointer-entry with the address playerbase and the offset 0. The effective addresses in the table are still the same, but are updated much faster - with the "wrong" way, it will take 4-5 seconds for values to get updated. (Thanks to Eric/DarkByte for pointing that out)




Whenever you try to refer a PID from a task manager back to cheat engine, r.click on the process list, convert PID to decimal. Somehow, I been missing this for years and been using calculator to convert the PID dec to hex back to CE.


If CE sort of pseudo-crash on you, where you cannot save your work but still can move around in cheat engine , error like out of memory, exception error, etc. Most of the time this happen to unity/mono game while mono features is on. You can copy paste your script/address to another cheat engine instance and save it without any error.


If some script didn't work as a user but you 100% sure you have the same game version with the cheat maker, try a different cheat engine version. Go up a version or down. I have at least 5 people that struggled to make cheat work, while 3 users literally took hours of finding root cause without avail. Changing to a different version solved their problem. Got 7.1,7.2,7.3,7.4 in my pc just for testing purposes.


This should be basic, but for beginner, If you're not sure why your script crash, pause the game by cheat engine pause hotkey, put a breakpoint around the injection point, resume the game. Step in to your script until you find the exact code before it crash.

creating cheat for a hobby, not obligated for requests or update.

my ct will always be free to be shared without removing the credit or where it originally came from.

anyone can update in case I'm not doing this anymore.


Did you know there is no globalDealloc? Each time you do a globalalloc and the name doesn't exist yet, it gets added to a memoyblock allocated in the target.

So, do not use unregisterSymbol these, unless the process has changed


globalalloc allocates the memory in a completely different part of the target program, and a label is just an address in the current block of memory.

Also, every script that uses globalalloc with the same name, gets the same address. So if script A uses globalloc(name,xxx) and script B use globalloc(name,yyy) then both will see name as the same address.


since not everyone knows:

code executing in $luacode runs in a different thread than the main(GUI) thread. That means it can not access GUI controls, like the addresslist and memoryrecords, unless you synchronize() the code first so it runs on the main thread


I just never really learned how Cheat Engine worked at all and just suffered through my failures to learn lol.

I did start by watching some very helpful tutorial videos from Sn34kyMofo Stephen Chapman on YouTube, but he didn't have any Mono hacking guides at that time so RIP.

Overall, the best guide is to read code and techniques from smart people who actually know what they're doing. I'm honestly still a novice compared to everyone else.

Oh, and also, the Cheat Engine Wiki is a super nice resource for learning.


Another thing useful for people to know: In proton_expiremental static memory that has been written to is still write_copy protected, so when scanning memory, include copy-on-write which is usually disabled by default (example: doom64)


You will get banned for using external programs to inject data into your game. That goes for cheat engine or anything else. No matter if you are using a local server or not but as I said. There is no reason to use cheats. They allow scripthook menus and server sided menus.


In your server and FiveM application data folder (wherever FiveM installed), there is a file named components.json, inside of it is all of the loaded components for FiveM. Somewhere in the middle/near the end there is adhesive and svadhesive, you can remove this.


Frida has been on my list of tools to look into for quite a while now but I've never really gottenaround to it. Either because it didn't quite fit the needs of the projects I was working on or because I was workingunder deadlines that didn't really allow for taking the time to learn a new tool.

So a couple of days ago I decided that since that situation probably isn't going to change any time soon, now is as good a time as any to throw inan quick, semi-useful weekend project to get my hands dirty with Frida. After all having another tool under your belt is always agood idea as you never know when it might come in handy.


Frida is a dynamic binary instrumentation framework similar to Intel PINor DynamoRIO.

The basic idea is that it lets you inject code into another binary without having to recompile so that you can e.g.observe memory allocations to check for leaks, observe branching behavior to create coverage statistics or todynamically change program state and variables to fix bugs, develop exploits or, as we are going to see, cheat invideo games ;).While I have used DynamoRIO on a couple of occasions in the past, what got me interested in Frida in particluaris its focus on portability and scriptability with bindings for a decent range of languages (here we will usea Python script to inject JavaScript code into the target binary), as well as its seamlessintegration with radare.


While I could just have read through a couple of tutorials and getting started guides and tried to replicate the instructionsI always find that I retain new information much better when applying it in a way that has some practical use for me.

Therefore I came up with the idea to use Frida as a scriptable cheat engine for SnowRunner.


Currently I am on my second playthrough of SnowRunner and while I do like the game a lot the system of ranks and experiencepoints always seemed kind of arbitrary to me. In particular on the one hand the game allows and even encourages switching between the various regions (Michigan, Alaska, Russia, ...) at any time and playing them in an non-linear order. On the otherhand, though, chained tires (without which Alaska is practically unplayable) only become available once you reach rank 10-15(depending on the vehicle).

So what better way to take Frida for a spin than using it to increase my rank so I can buy some winter tires ^^.


Now that we have a goal, lets see how we can get there.

Even though all we want to do is increase a current rank of e.g. 5 to, say, 16, finding a particular single digit valuein the several gigabytes of memory that the SnowRunner executable maps is probably not going to work without someadditional information.


Some more recognizable values might be the account balance (112500 in this case) or the player name. We'll assume thatsince all those values have something to do with the state of the active player profile they will be stored somewhatclose together in memory. So if we are able to find a not too large area of memory where all of those valuesoccur it will be safe to assume that these are our target variables and we can subsequently change them to ourdesired values.


Next we will take a look at each of these ranges to check if they contain our values.

We will start by searching for our current account balance and then refine our search in only those ranges thatcontain this value.

For this we will use Memory.scanSync(address, size, pattern).

The parameters address and size we can take directly from the data thatenumerateRanges() returned. pattern needs to be a string of hexadecimal valuesrepresenting the data in memory we are looking for.

To scan for our account balance we first convert 112500 to hex which yields 1B774.And because we are running on a little endian machine we will have to reverse the individual bytes which gives usa scan pattern of 74 B7 01 00.

Of course we don't have to do this conversion manually. After all one of the hallmarks of Frida is its scriptability.And we don't even have to do it in the JavaScript code that is going to run in the target process (which would notbe a big deal in this particular case but could become an issue if we needed to make more complicated calculationsbut did not want to introduce too much delay because e.g. timing of our operations might be important). Insteadwe can simply do the conversion in the Python script that is going to inject our JavaScript code into thetarget application.

3a8082e126
Reply all
Reply to author
Forward
0 new messages