From aae6c3aecdb04e8a6e33799287737a33a634418d Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 9 Jan 2017 21:58:55 -0500 Subject: Wrapping some unwrapped enumeration values, and adding il basic block indexing --- python/lowlevelil.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'python/lowlevelil.py') diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 4564bf13..419e8513 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -118,8 +118,7 @@ class LowLevelILInstruction(object): self.function = func self.expr_index = expr_index self.instr_index = instr_index - self.operation = instr.operation - self.operation_name = LowLevelILOperation(instr.operation) + self.operation = LowLevelILOperation(instr.operation) self.size = instr.size self.address = instr.address self.source_operand = instr.sourceOperand @@ -1261,6 +1260,15 @@ class LowLevelILBasicBlock(basicblock.BasicBlock): for idx in xrange(self.start, self.end): yield self.il_function[idx] + def __getitem__(self, idx): + size = self.end - self.start + if idx > size or idx < -size: + raise IndexError("list index is out of range") + if idx >= 0: + return self.il_function[idx + self.start] + else: + return self.il_function[self.end + idx] + def LLIL_TEMP(n): return n | 0x80000000 -- cgit v1.3.1