summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAndrew Lamoureux <andrew@vector35.com>2017-03-15 12:02:06 -0400
committerAndrew Lamoureux <andrew@vector35.com>2017-03-15 12:02:06 -0400
commitfa8006024f68a3c924cce95b2ffb62880aa99bed (patch)
treefa3265c38597ef0281bebd5f3b3582516cb53523 /python
parent27f1271083efb09efc6405f91be893ab38dad9a0 (diff)
convenience function for bytes->IL
new function: get_low_leveil_il_from_bytes() in Architecture example use: >>> arch.get_low_level_il_from_bytes('\xeb\xfe', 0x40DEAD) <il: jump(0x40dead)>
Diffstat (limited to 'python')
-rw-r--r--python/architecture.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/architecture.py b/python/architecture.py
index 39e5e72d..079d3f5f 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -1191,6 +1191,24 @@ class Architecture(object):
core.BNGetInstructionLowLevelIL(self.handle, buf, addr, length, il.handle)
return length.value
+ def get_low_level_il_from_bytes(self, data, addr):
+ """
+ ``get_low_level_il_from_bytes`` converts the instruction in bytes to ``il`` at the given virtual address
+
+ :param str data: the bytes of the instruction
+ :param int addr: virtual address of bytes in ``data``
+ :return: the instruction
+ :rtype: LowLevelILInstruction
+ :Example:
+
+ >>> arch.get_low_level_il_from_bytes('\xeb\xfe', 0x40DEAD)
+ <il: jump(0x40dead)>
+ >>>
+ """
+ func = lowlevelil.LowLevelILFunction(self)
+ self.get_instruction_low_level_il(data, addr, func)
+ return func[0]
+
def get_reg_name(self, reg):
"""
``get_reg_name`` gets a register name from a register number.