C++ Read Memory in Linux

Everything todo with programming goes HERE.
Post Reply
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1664
Joined: Thu Oct 20, 2011 2:11 pm

C++ Read Memory in Linux

Post by Light »

So, I've only ever seen how this could be done in Windows. Since I no longer have a Win partition, and I'm unwilling to install one, I was wanting to learn how to do it in Linux.

All I want to do is read a value from a given address. It wont be static addresses, so I'll make it ask for the address when you run it, and it would save as (probably a string?).

Note: This isn't for Tron. It is for a game, but mostly just to have fun. A bot in the game is overly useless, which is weird for an MMORPG. I just want to know how to do it, and it's bugging me I can't figure it out. Everywhere I read just warns that you're reading dynamic addresses and that it won't be the same when reloaded, which I am already aware of.

If there's not a huge difference, could you point me to writing to addresses as well? I know I could look at the source of EDB or Scanmem (assuming it's available, I think it is), but that won't do a whole lot for me. I kind'a need to learn the single part of it.

Thanks for any help. (:

User avatar
Light
Reverse Outside Corner Grinder
Posts: 1664
Joined: Thu Oct 20, 2011 2:11 pm

Re: C++ Read Memory in Linux

Post by Light »

I know, sad .. but my best attempt was this.

I tried to use tail and scanmem to use the write command by appending to the text file. The problem I've run into, is that it seems to work until I stick the tail & scanmem command into a screen. I need it in a screen so the script can continue to run after the shell command.

I've been testing this idea in PHP since it's just using shell commands for the main work, it doesn't really matter. I'm assuming there's a way to actually do it in C++ though, which is why I was curious to know.

Thought it might help if you see that I'm at least trying. :P If I could get scanmem to parse tail inside of a screen, I'd be happy with that as well, but I don't really see why it's not working.

User avatar
delinquent
Match Winner
Posts: 731
Joined: Sat Jul 07, 2012 3:07 am

Re: C++ Read Memory in Linux

Post by delinquent »

I read somewhere that C++ works better if you save output to current memory, and dump that to a text file after the sequence is run. That's made easier by allocating the task a certain amount of memory, and reserving that memory fir its specific use.

Post Reply