Keeping address in C++ hacking game code? [closed]

对着背影说爱祢 提交于 2019-12-31 01:06:32

问题


I have this code that edits addresses in a game to get unlimited ammo and what not, and I found out that the addresses are different for every computer, sometimes every time you restart the game, so how would I manage making this work still even though they change.


回答1:


If you get the address you're looking for, and then search for that address in memory to find the address of the pointer to that data, and then search for that address in memory so you can find the address of the pointer to it, and so on, you may eventually find an address that does not change. Then, at runtime, you can use that as a starting point and dereference it to find the location you're looking for. Of course, that all depends on how the data is laid out internally. It can get very complicated.




回答2:


Signature matching for the record contents in the heap. Maybe using edit distance against specific known content.

No harm I'm answering, since you had to ask, you probably don't have the chops to pull it off.




回答3:


The best way is to look for patterns in memory and work it out using offsets. It's not going to be simple simply because this is the sort of thing game developers want to stop.

So they're not going to have a nice text string saying "Ammo stored 27 bytes before the start of this string".

If they're doing tricky stuff like moving it around every time the game is run (and I would because I'm devious), you'll need to disassemble their code to find out how they locate the memory.

Then you do the same thing. I know, sounds easy and it is. But based on your past questions, I'm not sure 'H4cKL0rD' is a suitable moniker :-), at least in this case.

If you're uncomfortable with disassemblers, hex editors and such, there's almost certainly a program out there that will do it for you.




回答4:


You're either going to give up, or get very good with a disassembler.




回答5:


If you just want to get the job done and don't care about having coded it yourself, you could use a program which is designed specifically for this task, such as as T-Search.




回答6:


I'd say, preload some custom memory allocator and try to find what malloc() size you're looking for.

Since the data you're trying to hack is very likely to be stored in a structure with other parameters, knowing the structure size will allow you to take special action when you see an allocation of this size pass.

typedef struct {
   int ammo;
   int damage;
   int fire_distance;
} Sniper_AWP_T;

void *my_custom_malloc( int size ){
   void *ret = malloc(size);
   if( size == sizeof( Sniper_AWP_T ) ){
       hack_address = ret;
   }
   return ret;
}

// later on 

hack_address->ammo = 999;


来源:https://stackoverflow.com/questions/775481/keeping-address-in-c-hacking-game-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!