summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2017-03-24 11:20:39 -0400
committerPeter LaFosse <peter@vector35.com>2017-03-24 11:20:39 -0400
commit435e937c9705bc71cf1e7da1e08b23345a131360 (patch)
tree5a4d729acb0404c4c4059f0c7e8aa7c22136b649 /python
parent1e8e975ed8100c7a6186e8b27833a067ceaf05be (diff)
parentddaf7506e1802cfd4f9c78bcfb14deb0180b04d8 (diff)
Merge branch 'dev' into staging
Diffstat (limited to 'python')
-rw-r--r--python/architecture.py21
-rw-r--r--python/basicblock.py2
-rw-r--r--python/binaryview.py4
-rw-r--r--python/function.py4
4 files changed, 26 insertions, 5 deletions
diff --git a/python/architecture.py b/python/architecture.py
index 39e5e72d..d3778613 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -1177,6 +1177,9 @@ class Architecture(object):
``get_instruction_low_level_il`` appends LowLevelILExpr objects to ``il`` for the instruction at the given
virtual address ``addr`` with data ``data``.
+ This is used to analyze arbitrary data at an address, if you are working with an existing binary, you likely
+ want to be using ``Function.get_low_level_il_at``.
+
:param str data: max_instruction_length bytes from the binary at virtual address ``addr``
:param int addr: virtual address of bytes in ``data``
:param LowLevelILFunction il: The function the current instruction belongs to
@@ -1191,6 +1194,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.
diff --git a/python/basicblock.py b/python/basicblock.py
index 9f256aa7..5bec391b 100644
--- a/python/basicblock.py
+++ b/python/basicblock.py
@@ -194,7 +194,7 @@ class BasicBlock(object):
@property
def annotations(self):
"""List of automatic annotations for the start of this block (read-only)"""
- return self.function.get_block_annotations(self.arch, self.start)
+ return self.function.get_block_annotations(self.start, self.arch)
@property
def disassembly_text(self):
diff --git a/python/binaryview.py b/python/binaryview.py
index dd37be69..042c08f5 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -3776,7 +3776,7 @@ class BinaryWriter(object):
>>> hex(bw.offset)
'0x100000008L'
>>> bw.seek(0x100000000)
- >>> hex(br.offset)
+ >>> hex(bw.offset)
'0x100000000L'
>>>
"""
@@ -3793,7 +3793,7 @@ class BinaryWriter(object):
>>> hex(bw.offset)
'0x100000008L'
>>> bw.seek_relative(-8)
- >>> hex(br.offset)
+ >>> hex(bw.offset)
'0x100000000L'
>>>
"""
diff --git a/python/function.py b/python/function.py
index 86c93bf7..e1c202f9 100644
--- a/python/function.py
+++ b/python/function.py
@@ -289,12 +289,12 @@ class Function(object):
@property
def low_level_il(self):
- """Function low level IL (read-only)"""
+ """returns LowLevelILFunction used to represent Function low level IL (read-only)"""
return lowlevelil.LowLevelILFunction(self.arch, core.BNGetFunctionLowLevelIL(self.handle), self)
@property
def lifted_il(self):
- """Function lifted IL (read-only)"""
+ """returns LowLevelILFunction used to represent lifted IL (read-only)"""
return lowlevelil.LowLevelILFunction(self.arch, core.BNGetFunctionLiftedIL(self.handle), self)
@property