I generally preferred to play PC games. They are complicated bits of programming. In the past, most games had cheat codes, yet these days it’s more uncommon.
As a developer, I like to perceive how things work, so how about we figure out Linux game hacking and make a little cheat to have endless health and ammo.
How are game hacks made?
To see how cheats are made, some information about how programs and memory work is essential. Most common operating systems allow processes to read and write memory on other methods, which can be used to cheat in games. Qualities, for example, health, are regularly put away in progressively allocated memory. This implies that when the game is restarted, the memory address that keeps the health will change. In any case, there is, in every case, some static base ip location that focuses on the health address; we need to follow the pointers using static offsets.
The most famous tool to hack games is Cheat Engine. It is an open-source memory scanner and debugger. As most games on PC are for Windows, that is the essential focal point of the software. On Linux, it uses a client-server architecture, so we must download the Linux server and the Windows client, which must be executed on Wine.
Searching the health
The first step is to start the cheat engine server using sudo and then the client. Afterward, connect to the server on File > Open Process > Network > Connect and select the game process.
Presently we can look for health. Start with 100, examine, take damage, check again until we have few addresses left. Green locations are static, and discovering them so soon implies that it isn’t the location we need. We should attempt the different location and ” Find out what writes to this address. ” A bit of assembly knowledge is useful. We can see that the move instruction copies the value from the ecx register to the address we found.
We should add the location we found and “Discover what gets to this location,” We can see that numerous guidelines access this location. Since the health is being duplicated from here, we should look through every one of them until we discover some register worth 100 (decimal), 0x64 (hexadecimal). In here, we can put some breakpoints and debug the program. We can confirm this by adding the pointer and balance to the rundown of addresses and setting the sort to drift.
Presently we have to discover what gets to this pointer. These means of finding the base location may include experimentation.
An option in contrast to this backtracking is when we locate the actual health address; we do a pointer examination. We see two distinctive pointers ways. To pick the correct one, we can restart the game and see which focuses on health. The fixed base location with the counterbalance is equivalent to the one previously found.
Analyze information structures
To discover the ammunition, I took a fast alternate shortcut. Typically games store the player information in a strict or a class, and all things considered, almost certainly, the health and ammunition are in close memory proximity. Using the Dissect information structures highlight from the Memory Viewer > Tools > Dissect information/structures > Structures > Define new structure, we find that the ammunition is only a couple of bytes from the health.
Figuring out is hard. I appreciate the developers who need to investigate software/malware in similar ways. Making complicated cheats is additionally amazingly tedious. For instance, we can draw enemies through walls or even automatically aim and shoot against them by reading their coordinates and applying some game/engine dependent math, yet a ton of study is required.