From: Karim Hamidou Date: Sat, 30 Dec 2017 20:12:40 +0000 (+0100) Subject: The sandbox works! X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e291efea1dc64645b30ba8163827348eab930055;p=minival.git The sandbox works! --- diff --git a/requirements.txt b/requirements.txt index 658df1b..866ed39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,3 @@ flask==0.12.2 gunicorn==19.7.1 WTForms==2.1 Flask-WTF==0.14.2 - -python-ptrace==0.9.3 diff --git a/seccompctl.c b/seccompctl.c index 6d67d5d..f01dae9 100644 --- a/seccompctl.c +++ b/seccompctl.c @@ -84,6 +84,5 @@ int main(int argc, char **argv) { execve(args[0], (char **const) &args, NULL); } - return 0; } diff --git a/templates/index.html b/templates/index.html index f706830..f6f5475 100644 --- a/templates/index.html +++ b/templates/index.html @@ -19,7 +19,7 @@ Result:
             
-                {{ result }}
+            {{ result }}
             
         

diff --git a/web.py b/web.py index a6260cd..8fbf92d 100644 --- a/web.py +++ b/web.py @@ -31,7 +31,6 @@ def execute_in_sandbox(code): os.close(tmp_fd) with open(tmp_filename, 'w+') as fd: - fd.write('import prctl ; prctl.set_seccomp(True)\n') fd.write(code) read_pipe, write_pipe = os.pipe() @@ -41,10 +40,10 @@ def execute_in_sandbox(code): # if fork() -> share environment & everything # execve while limiting reads to anything not in /etc, blocking # anything else. - cmd = "/usr/bin/python" + cmd = "seccompctl" os.dup2(write_pipe, sys.stdout.fileno()) - # os.execv(cmd, [cmd, tmp_filename]) + os.execv(cmd, [cmd, "python", tmp_filename]) else: os.close(write_pipe) os.waitpid(pid, 0) @@ -62,4 +61,4 @@ def execute_in_sandbox(code): if __name__ == "__main__": - app.run() + app.run(host= '0.0.0.0')