In the past, most games had cheat codes, yet these days it’s more uncommon. As a programmer, I like to perceive how things work, so we should figure out an open-source game on Linux game hacking and make a little cheat to have boundless health and ammunition.
How are Linux hacks made?
To totally see how cheats are made, some information about how projects and memory work is significant. Most regular working frameworks permit cycles to peruse and compose memory on different cycles, which can be used to cheat in games. Qualities, for example, health are regularly put away in progressively dispensed 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 location that focuses on the health address, we simply need to follow the pointers utilizing static balances.
What is Cheat Engine
The most well-known 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 product. On Linux, it utilizes a customer worker design so we should download the Linux worker and furthermore the Windows customer, which should be executed on Wine.
Looking through the health
The initial step is to turn over the cheat motor worker and afterwards, the customer. A short time later interface with the worker on File > Open Process > Network > Connect and select the game cycle.
Presently we can look for health. Start with 100, check, take a touch of harm, examine again until we have not many locations. Green locations are static and discovering them so soon typically implies that it isn’t the location we need. How about we attempt the other location and “Discover what keeps in touch with this location”.
An option in contrast to this backtracking is the point at which we locate the genuine health address; we do a pointer filter. We see two diverse pointer ways, to pick the correct one we can restart the game and see which actually focuses on the health. The static base location with the counterbalance 0x18 is equivalent to the one recently found yet is getting determined utilizing the “xonotic-linux64-sdl” module address.
Dissect data structures
To discover the ammunition, I took a speedy, easy route. Typically games store the player information in a struct or a class and all things considered, almost certainly, the health and ammunition are in close memory closeness. By utilizing 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 bytes from the health.
To peruse and compose memory from different cycles, we need to consider APIs that rely upon the working framework. For Linux we can utilize ptrace or process_vm_readv and process_vm_writev. On Windows, the capacities ReadProcessMemory and WriteProcessMemory are accessible. On the other hand, a module (.so/.dll) can be infused into the game to try not to utilize these APIs and empower direct memory access. The best language for these low-level things is C or C++.
Figuring out is hard. I respect the analysts who need to dissect programming/malware also. Making complex cheats is additionally amazingly tedious. For instance, we can draw adversaries through dividers or even naturally point and shoot against them by perusing their directions and applying some game/motor ward math, however, a great deal of study is required.