handle network, run code as different user than compilation

This commit is contained in:
Brian Seymour 2018-10-22 19:14:17 -05:00
parent c94c7577fb
commit 7891b676eb
17 changed files with 30 additions and 24 deletions

View file

@ -1,3 +1,3 @@
cd /tmp/$1
timeout -s KILL 10 gcc -o binary -x c code.code
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./binary"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' ./binary"

View file

@ -1,3 +1,3 @@
cd /tmp/$1
timeout -s KILL 10 g++ -o binary -x c++ code.code
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./binary"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' ./binary"

View file

@ -1,3 +1,3 @@
cd /tmp/$1
timeout -s KILL 10 mcs $(echo code.code | sed 's/\///') -out:binary
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' mono binary"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' mono binary"

View file

@ -3,4 +3,4 @@ cp code.code interim.go
file="interim.go"
GOROOT=/usr/lib/go timeout -s KILL 10 go build $file
file=${file%%.*}
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./$file"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' ./$file"

View file

@ -3,4 +3,4 @@ cp code.code interim.java
name=$(cat interim.java | grep -Eo 'public\s+class\s+([A-Za-z0-9]+)' | sed -n 's/ */ /gp' | cut -d' ' -f3)
mv interim.java $name.java
timeout -s KILL 10 javac $name.java
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' java $name"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' java $name"

View file

@ -1,4 +1,4 @@
cd /tmp/$1
timeout -s KILL 10 nasm -f elf64 -o binary.o code.code
timeout -s KILL 10 ld binary.o -o binary
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ./binary"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' ./binary"

View file

@ -1,2 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' nodejs code.code"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' nodejs code.code"

View file

@ -1,2 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' php code.code"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' php code.code"

View file

@ -1,2 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' python2 code.code"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' python2 code.code"

View file

@ -1,2 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' python3.6 code.code"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' python3.6 code.code"

View file

@ -1,2 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' Rscript code.code"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' Rscript code.code"

View file

@ -1,2 +1,2 @@
cd /tmp/$1
timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' ruby code.code"
timeout -s KILL 3 runuser ubuntu -c "cat args.args | xargs -d '\n' ruby code.code"