summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2019-04-11 16:46:46 -0400
committerBrian Potchik <brian@vector35.com>2019-04-11 16:46:46 -0400
commit5e03e100bd0dcf5033476be3c3ab3ccad86532e6 (patch)
tree11bd229467247e9c344cf2a9ea13159f7799256b /python/binaryview.py
parent5e0e2f6c667e34f38c7d28d0f40f6d10d9d41492 (diff)
Add GetStringAtAddress to the API.
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index c92a9120..ca780fc4 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -3133,7 +3133,25 @@ class BinaryView(object):
result.append(StringReference(self, StringType(strings[i].type), strings[i].start, strings[i].length))
core.BNFreeStringReferenceList(strings)
return result
-
+
+ def get_string_at(self, addr):
+ """
+ ``get_string_at`` returns the string that falls on given virtual address.
+
+ :param int addr: virtual address to get the string from
+ :return: returns the StringReference at the given virtual address, otherwise None.
+ :rtype: StringReference
+ :Example:
+
+ >>> bv.get_string_at(0x40302f)
+ <StringType.AsciiString: 0x403028, len 0x12>
+
+ """
+ str_ref = core.BNStringReference()
+ if not core.BNGetStringAtAddress(self.handle, addr, str_ref):
+ return None
+ return StringReference(self, StringType(str_ref.type), str_ref.start, str_ref.length)
+
def get_ascii_string_at(self, addr, min_length=4, max_length=None, require_cstring=True):
"""
``get_ascii_string_at`` returns the string found at ``addr``