summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py16
-rw-r--r--python/mediumlevelil.py2
2 files changed, 16 insertions, 2 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.
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index 93c45dcc..103d8c5f 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -43,7 +43,7 @@ class SSAVariable(object):
return "<ssa %s version %d>" % (repr(self.var), self.version)
def __eq__(self, other):
- return (
+ return isinstance(other, SSAVariable) and (
(self.var, self.version) ==
(other.var, other.version)
)