From c9faafcc0c0b0beeb6cde0ee1359b3e3f27b05a0 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 1 Jul 2019 22:02:05 -0400 Subject: add contains for LLIL and MLIL basic blocks --- python/lowlevelil.py | 5 +++++ python/mediumlevelil.py | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'python') diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 8249afe8..f0a4e2a6 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -2889,6 +2889,11 @@ class LowLevelILBasicBlock(basicblock.BasicBlock): def __hash__(self): return hash((self.start, self.end, self._il_function)) + def __contains__(self, instruction): + if type(instruction) != LowLevelILInstruction or instruction.il_basic_block != self: + return False + return True + @property def il_function(self): """ """ diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 624f77a2..8d9768ec 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -1167,6 +1167,14 @@ class MediumLevelILBasicBlock(basicblock.BasicBlock): def __hash__(self): return hash((self.start, self.end, self.il_function)) + def __contains__(self, instruction): + if type(instruction) != MediumLevelILInstruction or instruction.il_basic_block != self: + return False + if instruction.instr_index >= self.start and instruction.instr_index <= self.end: + return True + else: + return False + @property def il_function(self): """ """ -- cgit v1.3.1