Search code examples
pythonram

Overflow while using ReadWriteMemory


I'm trying to fetch information from a hex editor. But ReadWriteMemory gives me an error about "<class 'OverflowError'>: int too long to convert"

Here is my code:

from ReadWriteMemory import ReadWriteMemory

base_address = 0x7FF6D60A0000
static_address_offset = 0x0074DE40
pointer_static_address = base_address + static_address_offset
offsets = [0x08, 0x08, 0xB0, 0x08, 0x278, 0x10, 0xD0]

rmw = ReadWriteMemory()
process = rmw.get_process_by_name('010Editor.exe')
process.open()
pointer = process.get_pointer(pointer_static_address, offsets=offsets)
pointer_value = process.read(pointer)
print(pointer_value)

How can I solve this?


Solution

  • I fixed it using 'pymem', So it appears that ReadWriteMemory can't handle 64bit applications.

    from pymem import *
    from pymem.process import *
    
    pm = Pymem('010Editor.exe')
    
    def GetByteNumber():
        def GetPtrAddr(base, offsets):
            addr = pm.read_longlong(base)
            for i in offsets:
                if i != offsets[-1]:
                    addr = pm.read_longlong(addr + i)
            return addr + offsets[-1]
        return pm.read_int(GetPtrAddr(pm.base_address + 0x0074DE40, offsets=[0x8, 0x8, 0x60, 0x8, 0x10, 0xB0, 0xD0]))