Changelog: bv.write and bv.insert require a bytes object in python3 Architecture.assemble outputs a bytes object in python3, a str in python2 Architecture.assemble will throw a value error if it cannot assemble the given instruction API install script should be run in the version of python you want it installed in Fundamental python changes to be aware of: Unicode-type strings are now just str, consequently anything that came out as a unicode string before (annotations) are now just str. Longs no longer exist. They're just ints.
Diffstat (limited to 'python/filemetadata.py')
-rw-r--r--python/filemetadata.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/python/filemetadata.py b/python/filemetadata.py
index 4bfc0214..cafe1d67 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -18,16 +18,15 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
+from __future__ import absolute_import
import traceback
import ctypes
-# Binary Ninja components
-import _binaryninjacore as core
-import startup
-import associateddatastore
-import log
-import binaryview
-
+# Binary Ninja Components
+import binaryninja
+from binaryninja import _binaryninjacore as core
+from binaryninja import associateddatastore #required for _FileMetadataAssociatedDataStore
+from binaryninja import log
class NavigationHandler(object):
def _register(self, handle):
@@ -66,12 +65,13 @@ class _FileMetadataAssociatedDataStore(associateddatastore._AssociatedDataStore)
class FileMetadata(object):
- _associated_data = {}
-
"""
``class FileMetadata`` represents the file being analyzed by Binary Ninja. It is responsible for opening,
closing, creating the database (.bndb) files, and is used to keep track of undoable actions.
"""
+
+ _associated_data = {}
+
def __init__(self, filename = None, handle = None):
"""
Instantiates a new FileMetadata class.
@@ -82,7 +82,7 @@ class FileMetadata(object):
if handle is not None:
self.handle = core.handle_of_type(handle, core.BNFileMetadata)
else:
- startup._init_plugins()
+ binaryninja._init_plugins()
self.handle = core.BNCreateFileMetadata()
if filename is not None:
core.BNSetFilename(self.handle, str(filename))
@@ -167,7 +167,7 @@ class FileMetadata(object):
view = core.BNGetFileViewOfType(self.handle, "Raw")
if view is None:
return None
- return binaryview.BinaryView(file_metadata = self, handle = view)
+ return binaryninja.binaryview.BinaryView(file_metadata = self, handle = view)
@property
def saved(self):
@@ -322,7 +322,7 @@ class FileMetadata(object):
lambda ctxt, cur, total: progress_func(cur, total)))
if view is None:
return None
- return binaryview.BinaryView(file_metadata = self, handle = view)
+ return binaryninja.binaryview.BinaryView(file_metadata = self, handle = view)
def save_auto_snapshot(self, progress_func = None):
if progress_func is None:
@@ -341,7 +341,7 @@ class FileMetadata(object):
view = core.BNCreateBinaryViewOfType(view_type, self.raw.handle)
if view is None:
return None
- return binaryview.BinaryView(file_metadata = self, handle = view)
+ return binaryninja.binaryview.BinaryView(file_metadata = self, handle = view)
def __setattr__(self, name, value):
try: