vivisect / vivisect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

implement protectMemory for vw and emu

williballenthin opened this issue · comments

def protect_memory(imem, va, size, perms):
    maps = imem._map_defs
    for i in range(len(maps)):
        map = maps[i]
        start, end, mmap, bytez = map
        mva, msize, mperms, mfilename = mmap

        if mva == va and msize == size:
            maps[i] = [start, end, [mva, msize, perms, mfilename], bytez]
            return

    raise KeyError("unknown memory map: 0x%x (0x%x bytes)", va, size)

Aye, I'd be open to a PR for implementing protect_memory with the usual test case or two. Wanna throw it up as a PR and we can work it through?