Is it possible to develop an ACM ONLINE JUDGE system using NODE.JS (or PYTHON)?

I'm a newbie, and if the question is so simple, I apologize for that.

Suppose I want to create a classic online judges system, obviously the main part

  • get user code to file
  • compile it on the server
  • run it on the server (with some sandboxes to prevent damage)
    • exit the program, then check the answer.
    • or get a signal to minimize the program.

I wonder if it's possible to do everything using Node.js, how to do things in the sandbox. Is there any example for compiling-sandbox-run-abort-check thing?

optional: is it more convenient to use such a system using PYTHON?

early.

+4
source share
2 answers

Most of these steps are standard - create a file, run a system call to compile something, spoof using I / O --- I think that any language should be able to do this, except for the very important step "work in the sandbox " I know several sandbox solutions:

  • use OS commands to limit or remove capabilities (chroot, setrlimit, file system permissions on Linux)
  • remove all dangerous functions from graduated language
  • interrupt system events
  • run the sandbox inside the virtual machine.

This list is probably not exhaustive. The system I'm connected to, http://cscircles.cemc.uwaterloo.ca uses option # 1. Again, most of the work is done in system calls, so I can’t imagine that one language is much better than another? We use php for high-level materials and C for sandboxing. Does this help answer your question?

+1
source

To execute the sandbox, it would be pretty easy to do this by simply running your code inside the closure, which reassigns all the alarming NaN calls

for example, if the code is executed inside a closure, where eval = NaN

0
source

Source: https://habr.com/ru/post/1400592/


All Articles