summaryrefslogtreecommitdiff
path: root/python/scriptingprovider.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2017-12-15 09:56:59 -0500
committerPeter LaFosse <peter@vector35.com>2017-12-15 10:00:07 -0500
commit4862340bc92c7bcde9d377cbf7cff1417a39509e (patch)
tree426987487c2d8523200cbfc04f7eea21ec5bf30c /python/scriptingprovider.py
parentb64d65be48ba44d9c2b564d88aec15430fd289df (diff)
Make multi-line python input more robust
Diffstat (limited to 'python/scriptingprovider.py')
-rw-r--r--python/scriptingprovider.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/scriptingprovider.py b/python/scriptingprovider.py
index 761b359c..6b03d49e 100644
--- a/python/scriptingprovider.py
+++ b/python/scriptingprovider.py
@@ -42,14 +42,14 @@ class _ThreadActionContext(object):
def __init__(self, func):
self.func = func
self.interpreter = None
- if "value" in dir(PythonScriptingInstance._interpreter):
+ if hasattr(PythonScriptingInstance._interpreter, "value"):
self.interpreter = PythonScriptingInstance._interpreter.value
self.__class__._actions.append(self)
self.callback = ctypes.CFUNCTYPE(None, ctypes.c_void_p)(lambda ctxt: self.execute())
def execute(self):
old_interpreter = None
- if "value" in dir(PythonScriptingInstance._interpreter):
+ if hasattr(PythonScriptingInstance._interpreter, "value"):
old_interpreter = PythonScriptingInstance._interpreter.value
PythonScriptingInstance._interpreter.value = self.interpreter
try:
@@ -380,7 +380,7 @@ class _PythonScriptingInstanceOutput(object):
def write(self, data):
interpreter = None
- if "value" in dir(PythonScriptingInstance._interpreter):
+ if hasattr(PythonScriptingInstance._interpreter, "value"):
interpreter = PythonScriptingInstance._interpreter.value
if interpreter is None:
@@ -419,7 +419,7 @@ class _PythonScriptingInstanceInput(object):
def read(self, size):
interpreter = None
- if "value" in dir(PythonScriptingInstance._interpreter):
+ if hasattr(PythonScriptingInstance._interpreter, "value"):
interpreter = PythonScriptingInstance._interpreter.value
if interpreter is None:
@@ -434,7 +434,7 @@ class _PythonScriptingInstanceInput(object):
def readline(self):
interpreter = None
- if "value" in dir(PythonScriptingInstance._interpreter):
+ if hasattr(PythonScriptingInstance._interpreter, "value"):
interpreter = PythonScriptingInstance._interpreter.value
if interpreter is None:
@@ -548,7 +548,7 @@ class PythonScriptingInstance(ScriptingInstance):
self.locals["current_mlil"] = self.active_func.medium_level_il
for line in code.split("\n"):
- self.interpreter.push(line)
+ self.interpreter.push(line + "\n")
if self.locals["here"] != self.active_addr:
if not self.active_view.file.navigate(self.active_view.file.view, self.locals["here"]):