Python: Add subscripting to root memory object

This commit is contained in:
Vicki Pfau 2017-10-09 11:37:25 -07:00
parent 5a6ee3aadc
commit 6b0847c472
1 changed files with 6 additions and 0 deletions

View File

@ -153,3 +153,9 @@ class Memory(object):
new_results = [MemorySearchResult(self, lib.mCoreMemorySearchResultsGetPointer(results, i)) for i in range(lib.mCoreMemorySearchResultsSize(results))]
lib.mCoreMemorySearchResultsDeinit(results)
return new_results
def __getitem__(self, address):
if isinstance(address, slice):
return bytearray(self.u8[address])
else:
return self.u8[address]