summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2019-06-27 17:54:48 -0400
committerJordan Wiens <jordan@psifertex.com>2019-06-27 17:54:48 -0400
commitef6cddbcef4184d1d41f80ac16c56c173e5d38f6 (patch)
tree2adb12e7ee1c9a8c5ee8528a7c2cd87c02099f43 /python
parent4dc4f1bb77da4c0fbbccb6178540c29c69d4184e (diff)
add comparators for MLIL and LLIL instructions
Diffstat (limited to 'python')
-rw-r--r--python/lowlevelil.py20
-rw-r--r--python/mediumlevelil.py20
2 files changed, 40 insertions, 0 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index dc679e9f..8249afe8 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -814,6 +814,26 @@ class LowLevelILInstruction(object):
return False
return self._function == value.function and self.expr_index == value.expr_index
+ def __lt__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index < value.expr_index
+
+ def __le__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index <= value.expr_index
+
+ def __gt__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index > value.expr_index
+
+ def __ge__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index >= value.expr_index
+
@property
def tokens(self):
"""LLIL tokens (read-only)"""
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index f73609cc..624f77a2 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -361,6 +361,26 @@ class MediumLevelILInstruction(object):
return False
return self._function == value.function and self._expr_index == value.expr_index
+ def __lt__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index < value.expr_index
+
+ def __le__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index <= value.expr_index
+
+ def __gt__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index > value.expr_index
+
+ def __ge__(self, value):
+ if not isinstance(value, type(self)):
+ return False
+ return self._function == value.function and self.expr_index >= value.expr_index
+
@property
def tokens(self):
"""MLIL tokens (read-only)"""