summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index fe7a9dc9..34b8b3e8 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -420,7 +420,7 @@ class BinaryViewType(with_metaclass(_BinaryViewTypeMetaclass, object)):
"""
sqlite = "SQLite format 3"
if filename.endswith(".bndb"):
- f = open(filename, 'r')
+ f = open(filename, 'rb')
if f is None or f.read(len(sqlite)) != sqlite:
return None
f.close()
@@ -2476,6 +2476,20 @@ class BinaryView(object):
core.BNFreeCodeReferences(refs, count.value)
return result
+ def get_data_refs(self, addr, length=None):
+ count = ctypes.c_ulonglong(0)
+ if length is None:
+ refs = core.BNGetDataReferences(self.handle, addr, count)
+ else:
+ refs = core.BNGetDataReferencesInRange(self.handle, addr, length, count)
+
+ result = []
+ for i in range(0, count.value):
+ result.append(refs[i])
+ core.BNFreeDataReferences(refs, count.value)
+ return result
+
+
def get_symbol_at(self, addr, namespace=None):
"""
``get_symbol_at`` returns the Symbol at the provided virtual address.