summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2019-05-14 21:34:57 -0700
committerPeter LaFosse <peter@vector35.com>2019-07-08 23:14:30 -0400
commitad37832dd4ffa112b10b523a151d3fa9b86b6c9d (patch)
tree364641f60f878150bb010c4b51f088e49c8ba058 /python/binaryview.py
parent7e7f0b41548057093fb48f1d8985712b619e9438 (diff)
PluginManager refactor for supporting plugin installation ui
Expose additional PluginManager APIs and update documentation
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 4ffe197e..4f146adc 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -645,7 +645,8 @@ class BinaryViewType(with_metaclass(_BinaryViewTypeMetaclass, object)):
:rtype: BinaryView or None
"""
sqlite = b"SQLite format 3"
- if filename.endswith(".bndb"):
+ isDatabase = filename.endswith(".bndb")
+ if isDatabase:
f = open(filename, 'rb')
if f is None or f.read(len(sqlite)) != sqlite:
return None
@@ -658,18 +659,21 @@ class BinaryViewType(with_metaclass(_BinaryViewTypeMetaclass, object)):
return None
for available in view.available_view_types:
if available.name != "Raw":
- if filename.endswith(".bndb"):
+ if isDatabase:
bv = view.get_view_of_type(available.name)
else:
bv = cls[available.name].open(filename)
+ break
+ else:
+ if isDatabase:
+ bv = view.get_view_of_type("Raw")
+ else:
+ bv = cls["Raw"].open(filename)
- if bv is None:
- raise Exception("Unknown Architecture/Architecture Not Found (check plugins folder)")
+ if bv is not None and update_analysis:
+ bv.update_analysis_and_wait()
+ return bv
- if update_analysis:
- bv.update_analysis_and_wait()
- return bv
- return None
def is_valid_for_data(self, data):
return core.BNIsBinaryViewTypeValidForData(self.handle, data.handle)