summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2020-09-28 16:50:27 +0800
committerXusheng <xusheng@vector35.com>2020-10-16 23:06:25 +0800
commitba72c577874c83567737d08ca64d3e52090763b7 (patch)
treef5a1c8d1778795f56e1657924ae50bd53adbd730 /python
parent8961012dca58c18afcdf1985b1cb554a5b1ad4c2 (diff)
add unit test for deprecated BinaryViewType
expose FileMetadata::GetExistingViews()
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py5
-rw-r--r--python/filemetadata.py11
2 files changed, 16 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index b7f5b745..e7c39641 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -731,6 +731,11 @@ class BinaryViewType(with_metaclass(_BinaryViewTypeMetaclass, object)):
"""BinaryView long name (read-only)"""
return core.BNGetBinaryViewTypeLongName(self.handle)
+ @property
+ def is_deprecated(self):
+ """returns if the BinaryViewType is deprecated (read-only)"""
+ return core.BNIsBinaryViewTypeDeprecated(self.handle)
+
def create(self, data):
view = core.BNCreateBinaryViewOfType(self.handle, data.handle)
if view is None:
diff --git a/python/filemetadata.py b/python/filemetadata.py
index c5f6b0f9..bfcfff90 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -28,6 +28,7 @@ from binaryninja import _binaryninjacore as core
from binaryninja import associateddatastore #required for _FileMetadataAssociatedDataStore
from binaryninja import log
from binaryninja.enums import SaveOption
+from binaryninja import pyNativeStr
class NavigationHandler(object):
def _register(self, handle):
@@ -433,3 +434,13 @@ class FileMetadata(object):
if view is None:
return None
return binaryninja.binaryview.BinaryView(file_metadata = self, handle = view)
+
+ @property
+ def existing_views(self):
+ length = ctypes.c_ulonglong()
+ result = core.BNGetExistingViews(self.handle, ctypes.byref(length))
+ views = []
+ for i in range(length.value):
+ views.append(pyNativeStr(result[i]))
+ core.BNFreeStringList(result, length)
+ return views \ No newline at end of file