Function to get the pointer address (x86)

def GetAddr(base: int, offsets: tuple) -> int:

    address = pm.read_uint(base)

    for i in offsets[:-1]:

        address = pm.read_uint(address + i)

    return address + offsets[-1]

🏆 One line of code to get the pointer address (x86)

GetAddr = lambda base, offsets, i = -1: GetAddr(pm.read_uint(base + (offsets[i] if i != -1 else 0)), offsets, i + 1) if i + 1 != len(offsets) else (base + offsets[-1])


# GetAddr(base: int, offsets: tuple) -> int

Patching bytes (x86/x64)

patch = b''

location = b''


pm = Pymem('game.exe')

client = pymem.process.module_from_name(pm.process_handle, 'client.dll')


address = pymem.pattern.pattern_scan_module(pm.process_handle, client, location)

pm.write_bytes(address, patch, len(patch))

I've seen this one done wrong in so many apps including some of mine. 

Just use pymem.pattern