summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2018-05-12 22:01:06 -0400
committerPeter LaFosse <peter@vector35.com>2018-05-12 22:01:06 -0400
commit0094fe08a8f8fbb51c787a358494893391b11654 (patch)
treef951fc5082bcfd83e2085698a5893eda7dda8932 /python
parentbcbf41603888f03beff805415982cc1d9623e2c1 (diff)
parent3f4a7a5d0c18bf91a4b43f574f66e516028e38c9 (diff)
Merge branch 'dev' into test_relocation
Diffstat (limited to 'python')
-rw-r--r--python/log.py3
-rw-r--r--python/plugin.py8
-rw-r--r--python/scriptingprovider.py7
3 files changed, 10 insertions, 8 deletions
diff --git a/python/log.py b/python/log.py
index f7144183..b1fd7095 100644
--- a/python/log.py
+++ b/python/log.py
@@ -21,6 +21,7 @@
# Binary Ninja components
import _binaryninjacore as core
+from enums import LogLevel
_output_to_log = False
@@ -135,7 +136,7 @@ def log_alert(text):
core.BNLogAlert("%s", str(text))
-def log_to_stdout(min_level):
+def log_to_stdout(min_level=LogLevel.InfoLog):
"""
``log_to_stdout`` redirects minimum log level to standard out.
diff --git a/python/plugin.py b/python/plugin.py
index c6cd9fc0..30a46412 100644
--- a/python/plugin.py
+++ b/python/plugin.py
@@ -560,8 +560,8 @@ class _BackgroundTaskMetaclass(type):
tasks = core.BNGetRunningBackgroundTasks(count)
result = []
for i in xrange(0, count.value):
- result.append(BackgroundTask(core.BNNewBackgroundTaskReference(tasks[i])))
- core.BNFreeBackgroundTaskList(tasks)
+ result.append(BackgroundTask(handle=core.BNNewBackgroundTaskReference(tasks[i])))
+ core.BNFreeBackgroundTaskList(tasks, count.value)
return result
def __iter__(self):
@@ -570,9 +570,9 @@ class _BackgroundTaskMetaclass(type):
tasks = core.BNGetRunningBackgroundTasks(count)
try:
for i in xrange(0, count.value):
- yield BackgroundTask(core.BNNewBackgroundTaskReference(tasks[i]))
+ yield BackgroundTask(handle=core.BNNewBackgroundTaskReference(tasks[i]))
finally:
- core.BNFreeBackgroundTaskList(tasks)
+ core.BNFreeBackgroundTaskList(tasks, count.value)
class BackgroundTask(object):
diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py
index e7838748..988f856d 100644
--- a/python/scriptingprovider.py
+++ b/python/scriptingprovider.py
@@ -650,6 +650,7 @@ original_stdin = sys.stdin
original_stdout = sys.stdout
original_stderr = sys.stderr
-sys.stdin = _PythonScriptingInstanceInput(sys.stdin)
-sys.stdout = _PythonScriptingInstanceOutput(sys.stdout, False)
-sys.stderr = _PythonScriptingInstanceOutput(sys.stderr, True)
+def redirect_stdio():
+ sys.stdin = _PythonScriptingInstanceInput(sys.stdin)
+ sys.stdout = _PythonScriptingInstanceOutput(sys.stdout, False)
+ sys.stderr = _PythonScriptingInstanceOutput(sys.stderr, True)