Kompiler is a code compiler API server for compiling and executing code on an isolated docker container.
- Python (2.7 or 3.5)
- C++ (gcc 4.9)
- C# (mono 4.2)
- Javascript (node 5.9)
- Pull docker images
cat docker_images.txt | xargs -I images docker pull images
- Install python requirements
pip install -r requirements.txt
- Run the server
python kompiler.py
- Try running
curl 'http://localhost:8000/compile/' -H 'content-type: application/json' --data-binary '{"code":"print(input())", "lang":"python", "stdin":"Hello World!"}'
- Or use Postman, though you may need to use urlencoded form data
The code or scripts are run isolated on different containers and could not possibly affect the host (the way Docker works). These containers are created when calling the API and are removed permanently after getting the output or timing out. Networking is disabled by default. Still, there might be some vulnerabilities, please submit an issue regarding your concern/s.
- Move hard-coded settings outside the script (memory/CPU limitations, timeout, server settings)
- Improve script transfer to container
- Add other languages
- Add some useful libraries for some environments
Feel free to submit pull requests
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :)
This project is licensed under the MIT License - see the LICENSE file for details