simple online judge
-
sudo apt install python3 python3-pip mysql-server
-
pip3 install django djangorestframework mysqlclient
-
Create empty database soj.(This is not a command!)
-
python3 manage.py makemigrations
-
python3 manage.py migrate
-
python3 manage.py createsuperuser --user admin
-
You can check soj/urls.py for routes, soj/oj/views.py for HTTP handlers.(This is not a command!)
-
python3 manage.py runserver 0.0.0.0:8080
-
You can use postman to test api.(This is not a command!)
-
Browse http://localhost:8080/admin to modeify your database.(This is not a command!)
- support C/C++, Java and Python3.
- RESTful.
- Very simple.
- Secured.
- code: user upload directory.
- sample: problem sample directory.
- soj/urls.py: routes.
- soj/oj/views.py: controller.
- soj/oj/models.py: app models.
- soj/oj/permissions.py: controller accessing permissions.
- soj/oj/utils/judge.py: main judge function.
- libfakelib.so: fake system call dynamic library which contains fake fork(), clone(), execv(), etc. check libfakelib.c for details.
- libsojsandbox.so: deprecated. check libsojsandbox.c for details.
- Use libseccomp to disable some system calls. Python had to load dynamic library to use sandbox. Also it's too expensive to use this tech here.
- Use LD_PRELOAD to enable fake system calls which do nothing. See Computer Systems: A Programmer's Perspective (3rd Edition) Randal E.Bryant / David O'Hallaron for details.