Commit 4a6dd64a authored by Luke Macken's avatar Luke Macken

Allow payloads to import pyrasite

parent 930523ba
...@@ -52,9 +52,12 @@ class CodeInjector(object): ...@@ -52,9 +52,12 @@ class CodeInjector(object):
self.filename = os.path.abspath(filename) self.filename = os.path.abspath(filename)
gdb_cmds = [ gdb_cmds = [
'PyGILState_Ensure()', 'PyGILState_Ensure()',
# Allow payloads to import modules alongside them # Allow payloads to import modules alongside them, and allow them
'PyRun_SimpleString("import sys; sys.path.insert(0, \\"%s\\");")' % # to 'import pyrasite' as well.
os.path.dirname(self.filename), 'PyRun_SimpleString("import sys; sys.path.insert(0, \\"%s\\"); '
'sys.path.insert(0, \\"%s\\")"' % (
os.path.dirname(self.filename),
os.path.join(os.path.abspath(__file__), '..')),
'PyRun_SimpleString("exec(open(\\"%s\\").read())")' % 'PyRun_SimpleString("exec(open(\\"%s\\").read())")' %
self.filename, self.filename,
'PyGILState_Release($1)', 'PyGILState_Release($1)',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment