开发者

How can I use data discovered via a memory scanner in an external program?

开发者 https://www.devze.com 2023-04-01 12:11 出处:网络
So, some background: I\'m using a memory scanner called cheat engine to get real-time values for game stats (e.g. hp, mana, exp) in a non open-source video game that I\'m trying to make a bot for.

So, some background: I'm using a memory scanner called cheat engine to get real-time values for game stats (e.g. hp, mana, exp) in a non open-source video game that I'm trying to make a bot for.

For my bot to effectively use this information, I need to get it from cheat engine (or any memory scanner with similar functionality) to my bot 开发者_如何学编程code in a timely manner.

Now, one obvious way to do that would be to save all of the information to a file and then load the file in my bot code, but since this data needs updating about every half second or so, that isn't a real solution.

What I really need is either a terribly convenient memory scanner that allows you to use the information you uncover as a set of variables in some programming language (preferably java, c, or matlab), or a way to access the memory addresses found in one of the above languages.

This latter option should hopefully be doable, as cheat engine gives the memory address, controlling process ID, and data type.


This question doesn't have an easy answer. As far as I can tell you are very new to this area, so what you really need is a proper introduction to the subject, and for that I recommend reading Exploiting Online Games: Cheating Massively Distributed Systems.

It's an awesome book and it shows in a detailed manner how game hacks work, and it dedicates an entire chapter on how to build bots.

If you want to write an application to read/write data to those memory addresses you need to investigate functions like ReadProcessMemory() and WriteProcessMemory(). Whatever language you to choose to implement your bot needs to provide access to the Windows API. This is needed because you have to manipulate another process' memory space.

There are lots of tutorials out there that shows how to do this using C and C++, since they are the preferred languages to do this kind of stuff. Another option is to use a macro tool if you want something simple to play the game for you.

Modern computer games implement their own anti-cheat mechanisms to make it a little more difficult for people like you (and me). And since this book presents attack and defense techniques I recommend it to anyone interested on how to exploit computer games. The book is fully loaded with code examples.

I'm sorry for not providing more information but I was criticized once in the past for helping people with your curiosity and I would also never do a better job than the authors of the book explaining how to do this stuff.


Try using the Lua interface to get what you need.

Here's an example (I have not tried it, but I'm assuming it works....)

http://forum.cheatengine.org/viewtopic.php?t=530047


You can probably use COM with a script in Lua (with LuaCOM) on one side and Matlab or C on the other


You would need to use a debugging library to do that. You would set a watchpoint on your variable's location, and when it triggers, you would get its value.

scanmem does that for Linux.

Unfortunately, many closed-source games go to great lengths to avoid the use of debuggers, so this won't probably work on your game.


Have you tried Visual VM?

http://visualvm.java.net/download.html


Cheat Engine is open source, so what you do is look in the source code of Cheat Engine, and look how the memory dump thing works.

However, it is highly non-trivial to monitor a live process that you are not controlling, so unless you are a black hat code wizard, level 11, I suspect that it won't work.

Even if You say You want to look at a few integers that you can guess looking at memory dump, it is a lot harder to find that area programmatically, consistently, while possibly retracking every so often as the data may be copied or moved when the state of the program changes.

Also read this encouraging citation from Cheat Engines FAQ:

Q:Will Cheat Engine work on online games?

A:Most of the time, no

But anyway, try it - it sounds fun and I am sure you will learn something, and there is always a chance that you'll make it work :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消