Pymem icon indicating copy to clipboard operation
Pymem copied to clipboard

Undoing memory changes

Open bcmeireles opened this issue 3 years ago • 1 comments

Hey, I'm trying to write some bytes to the memory of a game but after that undo the changes, how could I go about that? Currently doing

address = assembly.lpBaseOfDll + re.search(rb'\x80\xBB.....\x74\x09\x80\xBB.....', assemblyModule).start()
    game.write_bytes(address, b"\x90\x90\x90\x90\x90\x90\x90\x90\x90", 9)
    game.close_process()

Should I like

print(game.read_bytes(address, 9))

to get the original bytes and then just

game.write_bytes(address, b"\whatever the print above gave me", 9)

or is that the wrong way of approaching it

bcmeireles avatar Nov 03 '21 01:11 bcmeireles

You can simply save result of 'address' to another temp variable, then override it with your code and at the end write temp variable into process.

OpsecGuy avatar Feb 21 '22 20:02 OpsecGuy