Quote:
Originally Posted by Fantastix
1) is there a general consensus regarding best practices about the architecture of a bot?
|
Lol, this question can only come from a java developer

Depending on the kind of bot you surely have similar architectures for similar problems, but afaik the gamehacking scene is more of an "artists ground", software engineering with all it's patterns and best practices hasn't come to us yet
Quote:
Originally Posted by Fantastix
2) dll injection only applies hooking common methods that are in a dll right? but if the program uses methods that are not in a dll, there are more work involved (more debugging/decompiling works)?
|
DLL injection is a powerful tool as it allows you to write a program as a DLL and than, by injecting, executing it in the targets virtual memory. This allows you to fully access any resources of the process, as you are part of the process. You can use it to hook functions, you can also use it as a simple memory hack. As soon as you are in the targets memory space, you have full control over everything, thereby dll injection is always a good solution (if it's easy accomplishable)
Quote:
Originally Posted by Fantastix
3) any more readingn sources into that topic? (i saw the stickied threads)
|
Modern operating systems by Tanenbaum has really opend my eyes how an OS and processes on modern OS'es work. Really about game hacking I don't know. Also looking into reverse engineering can be quite helpful
Quote:
Originally Posted by Fantastix
4) so afaik anti cheat programs scans your memory to detect common cheat structures? do they have the access rights to see my memory dump? Oo
|
Well, anticheats do much more, and they evolve. For example they check the hash of all loaded libraries to make sure you didn't replace a DLL with your own so you could bypass the DLL injection protection. It really depends on the AS
Quote:
Originally Posted by Fantastix
5) ideally a bot lies between the UI-Layer and the method calling layer, basicly simulating the call of an action as if the user send that command to the game via the UI?
so what i want is to find the memory adresses of those methods and call them with my bot?
|
First of all, most games don't have a UI layer as you usually have with frameworks. So every game kinda has to implement the menus, controls, etc. all for itself (sure common engines have common functionality, but the overall architecture is for the programmer to decide). Games work much more like oldschool Windows 3 GUI applications written in Basic. (i.e. polling of events, and handling everything yourself).
But you can still hook/intercept or call the games functions by yourself, if you can find them. This is called reverse engineering, and isn't easy. You can for example run the process in cheatengine, IDA Pro or Binary Ninja, and check which code gets executed on which actions. But overall this is not simple
Quote:
Originally Posted by Fantastix
6) i need to read the gamestate correctly in order to act, so reading the gamestate also requires memory hacking, but how the hell do i find information about game states like the position of my character, i have no clue where to start here, since the value can be ANYTHING basicly
|
Debug your game (e.g. with cheat engine), run around and check which memory location changes with values that fit your movement. Maybe you have to chase some pointers to get the root pointer(somewhere located in .DATA or the stack).
Usually games are written in C++ (or any other compiled language) meaning it's likely that there is somewhere a continious block of memory that contains all infos of a character (i.e. the C++ character object). Than it's highly likely if you have x and y coordinates that the z coordinate is located somewhere near
Quote:
Originally Posted by Fantastix
ideally if i got the decompiled code: read it to understand how the program works, helps a ton (there are decompilers out there, but might be obfuscated)
|
I started to become a fan of Ghidra for reverse engineering (don't do it often, but for a noob like me ghidra is quite awesome), it has a great decompiler to C (as im really bad at reading assembly), and has a lot of usefull features (like constructing the CFG, etc.) and is completely free and open source. But it doesn't have a debugger, so you need some other tool for this (I think for game hacking cheat engine is quite good, im usually sticking to gdb, but im not into gamehacking so much)
Edit: something i just recalled, there is this game

which was developed for a CTF challange and is only beatable by hacking the game. It covers nealy everything from packet manipulation, memory manipulation, reverse engineering etc. and there are a tone of solutions out there if you can't solve it. I think this will teach you all the basics. The real problem is then getting past the anticheat in a real game