diff options
author | 2018-12-29 16:07:48 +0100 | |
---|---|---|
committer | 2018-12-29 16:07:48 +0100 | |
commit | 4347dab4cd9fd285423e3b6b5959c905599b79a3 (patch) | |
tree | 4c300976db39ebe29cad8e79c1e3ac3f32538fe1 | |
parent | Upgrades Pipfile.lock to use requests 2.20.1, fixes CVE-2018-18074 (#2) (diff) |
implementing repl like evaluation, the code doesnt work inside docker yet because its excluding parts of the stdlib from the venv for some reasonrepl-like
-rw-r--r-- | executor.py | 12 | ||||
-rw-r--r-- | snekbox.py | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/executor.py b/executor.py new file mode 100644 index 0000000..713412b --- /dev/null +++ b/executor.py @@ -0,0 +1,12 @@ +import sys +import ast + + +def main(): + code = sys.argv[1] + tree = ast.parse(code) + fake_interactive_tree = ast.Interactive() + fake_interactive_tree.body = tree.body + exec(compile(fake_interactive_tree, "<input>", "single"), {}, {}) + +main()
\ No newline at end of file @@ -44,7 +44,7 @@ class Snekbox(object): '--cgroup_pids_max=1', '--cgroup_mem_max=52428800', '--quiet', '--', - self.python_binary, '-ISq', '-c', cmd] + self.python_binary, '-ISq', '/snekbox/executor.py', cmd] try: proc = subprocess.Popen(args, stdin=subprocess.PIPE, |