| 21 | |
| 22 | |
| 23 | class ProcMap: |
| 24 | def __init__(self, vmas) -> None: |
| 25 | self.vmas = vmas |
| 26 | |
| 27 | def get_vmabyname(self, vma_name): |
| 28 | for vma in self.vmas: |
| 29 | if vma.vma_name is None: |
| 30 | continue |
| 31 | if vma_name in vma.vma_name: |
| 32 | return vma |
| 33 | return None |
| 34 | |
| 35 | def get_vmabyaddr(self, addr): |
| 36 | for vma in self.vmas: |
| 37 | if addr <= vma.end and addr >= vma.base: |
| 38 | return vma |
| 39 | return None |
| 40 | |
| 41 | def get_vmaaddroff(self, addr): |
| 42 | vma = self.get_vmabyaddr(addr) |
| 43 | print(hex(addr), hex(vma.base)) |
| 44 | return addr - vma.base |
| 45 | |
| 46 | |
| 47 | class PocMap_VMA: |