From 9d04f1929dd24dc46ab369ecd6a693b7ea54ddd3 Mon Sep 17 00:00:00 2001 From: Brian Seymour Date: Fri, 2 Oct 2020 18:51:00 -0500 Subject: [PATCH] readd brainfuck support --- api/main.go | 3 +++ lxc/execute | 3 +++ lxc/executors/brainfuck | 2 ++ 3 files changed, 8 insertions(+) create mode 100644 lxc/executors/brainfuck diff --git a/api/main.go b/api/main.go index 8e475fc..3ca388d 100644 --- a/api/main.go +++ b/api/main.go @@ -67,6 +67,7 @@ func Execute(res http.ResponseWriter, req *http.Request) { whitelist := []string{ "awk", "bash", + "brainfuck", "bf", "c", "cpp", "c++", "csharp", "cs", "c#", @@ -138,6 +139,8 @@ func launch(request Inbound, res http.ResponseWriter) { execlang := request.Language switch execlang { + case "bf": + execlang = "brainfuck" case "c++": execlang = "cpp" case "cs", "c#": diff --git a/lxc/execute b/lxc/execute index 05d6175..248caee 100755 --- a/lxc/execute +++ b/lxc/execute @@ -48,6 +48,9 @@ case "$lang" in "bash") bin=bash ;; +"brainfuck" | "bf") + bin=brainfuck + ;; "c") bin=c ;; diff --git a/lxc/executors/brainfuck b/lxc/executors/brainfuck new file mode 100644 index 0000000..b4458a0 --- /dev/null +++ b/lxc/executors/brainfuck @@ -0,0 +1,2 @@ +cd /tmp/$2 +runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 brainfuck code.code"