]> khamidou — GitHub mirrors - minival.git/commitdiff
The sandbox works!
authorKarim Hamidou <khamidou@gmail.com>
Sat, 30 Dec 2017 20:12:40 +0000 (21:12 +0100)
committerKarim Hamidou <khamidou@gmail.com>
Sat, 30 Dec 2017 20:12:40 +0000 (21:12 +0100)
requirements.txt
seccompctl.c
templates/index.html
web.py

index 658df1b8e4dfd66b810ed277f2337d0c5290e6c3..866ed39617bfd5ec366c754f59e336ab701875df 100644 (file)
@@ -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
index 6d67d5d6afc1cdd93ee3be349883f2a43f2b2f1e..f01dae97adde6ddbdce4773bf77ebcbb4ca9efc8 100644 (file)
@@ -84,6 +84,5 @@ int main(int argc, char **argv) {
         execve(args[0], (char **const) &args, NULL);
     }
 
-
     return 0;
 }
index f706830984f9943e1ce68275b1a7676facda7136..f6f5475853d783cd3ea324f98a07ce4fdf0dfd0c 100644 (file)
@@ -19,7 +19,7 @@
         <b>Result:</b>
         <pre>
             <code>
-                {{ result }}
+            {{ result }}
             </code>
         </pre>
         </p>
diff --git a/web.py b/web.py
index a6260cd48bd6d3ffca82f7cca340f7454ab0f614..8fbf92d7bd43c74814bf03ab9c5ab16e812164a0 100644 (file)
--- 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')