diff options
author | 2019-03-24 17:35:43 -0600 | |
---|---|---|
committer | 2019-03-24 17:35:43 -0600 | |
commit | 1f49e3edd7a1167eb81438c57dc1dd3789bb0b3b (patch) | |
tree | b71e0889a4ea6ed8d22852b9805bd13a60994f00 /snekbox.py | |
parent | Cleanup imports and RMQ (diff) |
More formatting fixes
Diffstat (limited to 'snekbox.py')
-rw-r--r-- | snekbox.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -12,8 +12,7 @@ class Snekbox: def __init__(self, nsjail_binary='nsjail', - python_binary=os.path.dirname(sys.executable)+os.sep+'python3.6'): - + python_binary=os.path.dirname(sys.executable) + os.sep + 'python3.6'): self.nsjail_binary = nsjail_binary self.python_binary = python_binary self._nsjail_workaround() @@ -46,6 +45,7 @@ class Snekbox: Returns the output of executing the command (stdout) if successful, or a error message if the execution failed. """ + args = [self.nsjail_binary, '-Mo', '--rlimit_as', '700', '--chroot', '/', @@ -108,6 +108,7 @@ class Snekbox: to RMQ. Once published, the system exits, since the snekboxes are created and disposed of per-execution. """ + msg = body.decode('utf-8') result = '' snek_msg = json.loads(msg) @@ -124,6 +125,7 @@ class Snekbox: def message_handler(self, ch, method, properties, body, thread_ws=None): """Spawns a daemon process that handles RMQ messages.""" + p = multiprocessing.Process(target=self.execute, args=(body,)) p.daemon = True p.start() |