summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2018-08-28 17:19:32 -0400
committerRusty Wagner <rusty@vector35.com>2018-08-28 17:19:32 -0400
commit20e06506a3d96c7327ca5d729ab01e8c2a7cff3c (patch)
tree65880063ccbdcb45cc247a0138915d8560d2ec27 /python
parent5841af2db8e8dcf4e0da0c438ac040c5fa90038b (diff)
parent426bb3d8b47b93658bf969c429a8b98adae13c30 (diff)
Merge branch 'dev' into test_stack_adjust
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py3
-rw-r--r--python/binaryview.py11
-rw-r--r--python/downloadprovider.py8
-rw-r--r--python/filemetadata.py11
-rw-r--r--python/lowlevelil.py5
-rw-r--r--python/mediumlevelil.py5
-rw-r--r--python/scriptingprovider.py7
-rw-r--r--python/update.py2
8 files changed, 45 insertions, 7 deletions
diff --git a/python/__init__.py b/python/__init__.py
index aa7c1ed4..9f8cbc79 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -251,3 +251,6 @@ core_product_type = core.BNGetProductType()
core_license_count = core.BNGetLicenseCount()
'''License count from the license file'''
+
+core_ui_enabled = core.BNIsUIEnabled()
+'''Indicates that a UI exists and the UI has invoked BNInitUI'''
diff --git a/python/binaryview.py b/python/binaryview.py
index d84ed0aa..5786a5c8 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1099,6 +1099,15 @@ class BinaryView(object):
def max_function_size_for_analysis(self, size):
core.BNSetMaxFunctionSizeForAnalysis(self.handle, size)
+ @property
+ def new_auto_function_analysis_suppressed(self):
+ """Whether or not automatically discovered functions will be analyzed"""
+ return core.BNGetNewAutoFunctionAnalysisSuppressed(self.handle)
+
+ @new_auto_function_analysis_suppressed.setter
+ def new_auto_function_analysis_suppressed(self, suppress):
+ core.BNSetNewAutoFunctionAnalysisSuppressed(self.handle, suppress)
+
def __len__(self):
return int(core.BNGetViewLength(self.handle))
@@ -1739,7 +1748,7 @@ class BinaryView(object):
self.file.redo()
def navigate(self, view, offset):
- self.file.navigate(view, offset)
+ return self.file.navigate(view, offset)
def read(self, addr, length):
"""
diff --git a/python/downloadprovider.py b/python/downloadprovider.py
index 14368ee7..1c94aef3 100644
--- a/python/downloadprovider.py
+++ b/python/downloadprovider.py
@@ -26,6 +26,8 @@ import traceback
# Binary Ninja Components
import binaryninja._binaryninjacore as core
+
+import binaryninja
from binaryninja.setting import Setting
from binaryninja import with_metaclass
from binaryninja import startup
@@ -79,7 +81,7 @@ class _DownloadProviderMetaclass(type):
@property
def list(self):
"""List all DownloadProvider types (read-only)"""
- startup._init_plugins()
+ binaryninja._init_plugins()
count = ctypes.c_ulonglong()
types = core.BNGetDownloadProviderList(count)
result = []
@@ -89,7 +91,7 @@ class _DownloadProviderMetaclass(type):
return result
def __iter__(self):
- startup._init_plugins()
+ binaryninja._init_plugins()
count = ctypes.c_ulonglong()
types = core.BNGetDownloadProviderList(count)
try:
@@ -99,7 +101,7 @@ class _DownloadProviderMetaclass(type):
core.BNFreeDownloadProviderList(types)
def __getitem__(self, value):
- startup._init_plugins()
+ binaryninja._init_plugins()
provider = core.BNGetDownloadProviderByName(str(value))
if provider is None:
raise KeyError("'%s' is not a valid download provider" % str(value))
diff --git a/python/filemetadata.py b/python/filemetadata.py
index cafe1d67..4d51f4d9 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -114,8 +114,17 @@ class FileMetadata(object):
_FileMetadataAssociatedDataStore.set_default(name, value)
@property
+ def original_filename(self):
+ """The original name of the binary opened if a bndb, otherwise reads or sets the current filename (read/write)"""
+ return core.BNGetOriginalFilename(self.handle)
+
+ @original_filename.setter
+ def original_filename(self, value):
+ core.BNSetOriginalFilename(self.handle, str(value))
+
+ @property
def filename(self):
- """The name of the file (read/write)"""
+ """The name of the open bndb or binary filename (read/write)"""
return core.BNGetFilename(self.handle)
@filename.setter
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index e714eb48..41579719 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -537,6 +537,11 @@ class LowLevelILInstruction(object):
return result
@property
+ def il_basic_block(self):
+ """IL basic block object containing this expression (read-only) (only available on finalized functions)"""
+ return LowLevelILBasicBlock(self.function.source_function.view, core.BNGetLowLevelILBasicBlockForInstruction(self.function.handle, self.instr_index), self.function)
+
+ @property
def ssa_form(self):
"""SSA form of expression (read-only)"""
return LowLevelILInstruction(self.function.ssa_form,
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index 774231ab..c7b21aa9 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -335,6 +335,11 @@ class MediumLevelILInstruction(object):
return result
@property
+ def il_basic_block(self):
+ """IL basic block object containing this expression (read-only) (only available on finalized functions)"""
+ return MediumLevelILBasicBlock(self.function.source_function.view, core.BNGetMediumLevelILBasicBlockForInstruction(self.function.handle, self.instr_index), self.function)
+
+ @property
def ssa_form(self):
"""SSA form of expression (read-only)"""
return MediumLevelILInstruction(self.function.ssa_form,
diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py
index 37642ed4..5b5d830e 100644
--- a/python/scriptingprovider.py
+++ b/python/scriptingprovider.py
@@ -612,7 +612,10 @@ class PythonScriptingInstance(ScriptingInstance):
return ScriptingProviderExecuteResult.SuccessfulScriptExecution
try:
- result = code.compile_command(text)
+ if isinstance(text, str):
+ result = code.compile_command(text)
+ else:
+ result = code.compile_command(text.decode("charmap"))
except:
result = False
@@ -661,4 +664,4 @@ def redirect_stdio():
sys.stdin = _PythonScriptingInstanceInput(sys.stdin)
sys.stdout = _PythonScriptingInstanceOutput(sys.stdout, False)
sys.stderr = _PythonScriptingInstanceOutput(sys.stderr, True)
- sys.excepthook = sys.__excepthook__ \ No newline at end of file
+ sys.excepthook = sys.__excepthook__
diff --git a/python/update.py b/python/update.py
index 7f5d6f9c..90128056 100644
--- a/python/update.py
+++ b/python/update.py
@@ -23,6 +23,8 @@ import ctypes
# Binary Ninja components
from binaryninja import _binaryninjacore as core
+
+import binaryninja
from binaryninja.enums import UpdateResult
# 2-3 compatibility