1

in the sample script

import pymem
import pymem.process
import pymem.memory

process = pymem.process
mem = pymem.memory



DMC5 = pymem.Pymem("Game.exe")
DMC5_base = DMC5.process_handle

         
adress = 0x1F1BFF714C8
value = 99

mem.write_int(DMC5_base, adress, value)

the script works fine without any problems. but if I turn off the game and turn it on again, the address will change and you will have to manually insert a new one into the script. Is there any way to enter static data?

2 Answers 2

0

To find a reliable pointer, you need to find a static address, plus offsets, that always points to the address you want. This is a common issue when cheating in games via memory modification. Here's a tutorial on how to do it for Cheat Engine: https://www.solarstrike.net/phpBB3/viewtopic.php?t=65

Here's another tutorial on how to do it with MHS + CE: https://progamercity.net/ghack-tut/229-tutorial-maplestory-finding-pointers-ce-amp-mhs.html

Essentially though, the way it's typically done is via using a debugger to get the address of any code that reads or writes the address, and then introspect the assembly code to determine what addresses and pointers were used to get that address. Then, you take the base address it added the pointer to, and then use the debugger to see what reads that value, and what offsets and pointers it uses. You'll usually have to do this 2-3 times before you'll find a static address.

Once you get the pointer offsets and base address, you would then access that memory address via regular pointer logic. Here's an example of how: How do I look up the value of a multi-level pointer inside a process in Python?

You can also use the ReadWriteMemory module.

For example - here's a Python script that reads and writes the multi-level pointer value from Step 8 of the 32-bit Cheat Engine tutorial:

from ReadWriteMemory import ReadWriteMemory

base_address = 0x00400000  # "Tutorial-i386.exe"
static_address_offset = 0x002426E0  # the offset from the base of the static address of the pointer chain
pointer_static_address = base_address + static_address_offset  # "Tutorial-i386.exe" + 2426E0
offsets = [0x0C, 0x14, 0x00, 0x18]

rwm = ReadWriteMemory()
process = rwm.get_process_by_name('Tutorial-i386.exe')
process.open()
my_pointer = process.get_pointer(pointer_static_address, offsets=offsets)
pointer_value = process.read(my_pointer)
print(f'Value: {pointer_value}')
value_to_set = int(input('Enter a value: '))
process.write(my_pointer, value_to_set)
Sign up to request clarification or add additional context in comments.

13 Comments

I've already mastered doing this with the cheat engine. CheatEngine saves this address, however, and so changes, but in the cheat engine it is static. The problem now is that if the address changes (but in the cheat engine you rather know how it is, it saves it) and I can't put it into the program code because the address keeps changing
Your comment doesn't make sense to me. If you found the static address and offsets in Cheat Engine, then you already have everything you need. Cheat engine doesn't do magic when the address changes, it just uses basic pointer logic. You just need to do basic pointer logic in Python to get the address you want. As for getting the base address of the .exe, here is how.
otherwise, now I want the same to happen in python
@mikethecoonlik I know. I updated my answer with more info.
@mikethecoonlik I updated it again. There should be far more than enough info now for you to get started. Let me know if you get stuck though.
|
0

Theres a very big chance you will find the offsets listed on some forum i reccomend googling for the offsets

1 Comment

Please provide more enough explanation and if u have some links will be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.