Giter Club home page Giter Club logo

compilebox's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compilebox's Issues

run app.js failed

Listening at 80
events.js:85
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at HTTPServer.Server._listen2 (net.js:1129:14)
at listen (net.js:1155:10)
at HTTPServer.Server.listen (net.js:1240:5)
at Object. (/home/qnhu/Downloads/compilebox/API/app.js:74:5)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)

/usercode permission issue

Docker container was ran as user mysql, which leads to permission denied issue.

root@vagrant-ubuntu-trusty-64:/compilebox/API/temp/testfolder# docker run -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v  "/compilebox/API/temp/testfolder":/usercode virtual_machine /usercode/script.sh python file.py 
/usercode/script.sh: line 41: /usercode/logfile.txt: Permission denied
/usercode/script.sh: line 42: /usercode/errors: Permission denied
Hello!
*-COMPILEBOX::ENDOFOUTPUT-* .03
mv: cannot stat '/usercode/logfile.txt': No such file or directory

If you actually run commands in script.sh one by one in docker container, /usercode belongs to root but not mysql. User mysql does not have permission to create /usercode/logfile.txt and /usercode/errors.

This could be fixed by changing docker user to root.

I am wondering why we need sql in docker container? Is it possible to remove it? I can't see anywhere else has dependency on mysql other than following ones:

$ grep -r mysql .
./DockerSandbox.js:    var st = this.path+'DockerTimeout.sh ' + this.timeout_value + 's -u mysql -e \'NODE_PATH=/usr/local/lib/node_modules\' -i -t -v  "' + this.path + this.folder + '":/usercode ' + this.vm_name + ' /usercode/script.sh ' + this.compiler_name + ' ' + this.file_name + ' ' + this.output_command+ ' ' + this.extra_arguments;
./Payload/sql_runner.sh:sudo service mysql start
./Payload/sql_runner.sh:mysql  mysql< create_user.sql -u'root' 
./Payload/sql_runner.sh:mysql  ri_db < $1 -u'test' -p'test123'
./Payload/sql_runner.sh:mysql  mysql< destroy_user.sql -u'root'
./temp/testfolder/sql_runner.sh:sudo service mysql start
./temp/testfolder/sql_runner.sh:mysql  mysql< create_user.sql -u'root' 
./temp/testfolder/sql_runner.sh:mysql  ri_db < $1 -u'test' -p'test123'
./temp/testfolder/sql_runner.sh:mysql  mysql< destroy_user.sql -u'root'

implementation of Multiple test case input

i want to add a functionality to compile the code against multiple test cases. any ideas how can i do so.
example:
i have a python code
def simpleArraySum(n,ar):
s = 0
for i in ar:
s += i
return s
n = int(raw_input().strip())
ar = map(int, raw_input().strip().split(' '))
result = simpleArraySum(n,ar)
print(result)

i want to test it against more then one inputs i.e. 6\n1 2 3 4 5 6 and 5\n5 6 9 8 7

ENOENT

Listening at 3000
{ Error: ENOENT: no such file or directory, open 'D:\bots\compilebox\API\temp\3cadc404b2011a3643a7\file.py'
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'D:\\bots\\compilebox\\API\\temp\\3cadc404b2011a3643a7\\file.py' }

I am running on Windows 10 64 bit, what is the problem here. It seems file.py was not created under temp. I ran UpdateDocker.sh under Setup. What am I missing Thanks

npm ERR! Error: CERT_UNTRUSTED

Today I got this CERT_UNTRUSTED issue while install the compilebox. I set npm config set strict-ssl false to bypass https. Everything worked fine for now.

Time out issue when i run program

Hi,
when i select the language id and run program then its coming time out error. I give what the ever language id same time out issue. may i know whats wrong.

Regards,
Prasad M
capture1

Infinite Loops

Referencing issue #7 , it doesn't seem to have been addressed, and infinite loops are very much a problem, they don't seem to timeout

  • Zach

Integrating with docker-compose

Has anybody tried to integrate compilebox with docker-compose? I have tried and haven't succeeded.

From the beginning, I was trying to create docker-in-docker. I had a container with node js app, inside which I had tried to create another container where the code would be executed (virtual_machine). But I didn't know how to do that correctly.

Then I found another way: expose the Docker socket to the container with node js app using this command (described here https://stackoverflow.com/questions/27879713/is-it-ok-to-run-docker-from-inside-docker):

docker run -v /var/run/docker.sock:/var/run/docker.sock ...

Thereby I have access to all my images inside the container with nodejs app.

But when nodejs app creates virtual_machine container, there is always a timeout error:

Listening at 8080
Python file was saved!
Input file was saved!
/api/DockerTimeout.sh 20s -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v  "/api/temp/024d82bd43cdd787649e":/usercode virtual_machine /usercode/script.sh python file.py  
------------------------------
ATTEMPTING TO REMOVE: temp/024d82bd43cdd787649e
------------------------------
Timed Out: temp/024d82bd43cdd787649e Python
Time: 
undefined

I think this error raises because nodejs app creates "sibling" container instead of "child" container. I'm not sure. Has anybody struggled with this problem?

How to enter input stream

Hello,

I don't see anyone mentioning the input stream for the program via Terminal simulator web.

If I have the following block code, how will the input stream enter?

#include <stdio.h>
int main() {
 int a;
 int b;

 scanf("%d", &a);
 printf("You entered for a: %d", a);
 scanf("%d", &b);
 printf("You entered for b: %d", b);
 return 0;
}

use of success in DockerSandbox.js

i want to know that in dockerSandbox.js run , prepare and execute all methods require a success argument but while calling run method we pass nothing, how did it get success then also in execute and prepare er call success()....where this came from why it dont throw a error and what its use

Everything times out

Hey,

I've installed everything following the instructions in the readme but all tests of the language timeout. I installed compilebox on a DigitalOcean instance with 2gigs of RAM which should be sufficient.

This is as far as I'm getting.

Listening at 80
Python file was saved!
Input file was saved!
/root/API/DockerTimeout.sh 15s -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v  "/root/API/temp/016d76e1fbe201279745":/usercode virtual_machine /usercode/script.sh python file.py
------------------------------
ATTEMPTING TO REMOVE: temp/016d76e1fbe201279745
------------------------------
Timed Out: temp/016d76e1fbe201279745 Python
Time:
undefined

Everything is returning timeout error


ATTEMPTING TO REMOVE: temp/0a548770a09aa9346eab

Timed Out: temp/0a548770a09aa9346eab Python
Time:
undefined

Getting this while trying to run a python script 'print "Hello"'

Anyone know any ways of fixing this? DigitalOcean 2GB of Ram

JavaScript Input

Is there a way to take input for compiling javascript, if so may I please have an example?

lots of error

hello..
i have try to used your docker images but lots of error not success to working.
So please verify it and also possible so make it working script for Ubuntu16 or centos without docker

Thanks

Error Installing on ubuntu 14.04 LTS

Error is
2 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up docker.io (1.6.2~dfsg1-1ubuntu4~14.04.1) ... addgroup: The groupdocker' already exists as a system group. Exiting.
/etc/init.d/docker: 71: /etc/init.d/docker: cgroupfs_mount: not found
invoke-rc.d: initscript docker, action "start" failed.
dpkg: error processing package docker.io (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up cgroup-lite (1.9) ...
invoke-rc.d: unknown initscript, /etc/init.d/cgroup-lite not found.
dpkg: error processing package cgroup-lite (--configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
docker.io
cgroup-lite
E: Sub-process /usr/bin/dpkg returned an error code (1)
NodeJS setup Complete
docker.io: unrecognized service
Creating Docker Image
FATA[0000] Post http:///var/run/docker.sock/v1.18/build?cpusetcpus=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=virtual_machine: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
Retrieving Installed Docker Images
FATA[0000] Get http:///var/run/docker.sock/v1.18/images/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS? `

Run Hello with python not work

My test server os is Ubuntu 14.04LTS. And while doing tutorial on README, I got little problem.
I just want to test my installation, and did below command in directory 'API'

 $ npm install .

And, error was occurred.

npm ERR! peerinvalid The package express does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "express" "--save"
npm ERR! cwd /home/jtlim/compilebox/API
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/jtlim/compilebox/API/npm-debug.log
npm ERR! not ok code 0

I suppose there is some problem about version of express,
so I edit package.json as below(just change version specification of express)

 {
  "name": "API",
  "version": "1.0.0",
  "main": "app.js",
  "dependencies": {
    "express": "4.*",
    "express-brute":"*",
    "exports": "*"
  },
  "author": "Osman Ali",
  "license": "MIT"
}

Finally installation check is completed.
Is this temporary remedy right way to do?

Incorrectly reports Time-out Error when Server is Down

After running for a while, the Docker instance for running code goes down.
When this happens, the node.js app reports "Execution timed out" (as if the code just wouldn't complete in time) instead of throwing an error that the server is down.

Install on Mac OSX

Can I install on Mac OSX?
Because if I want to use Ubuntu/CentOS, I have to install Docker-in-Docker:
Docker image 1: Cent OS/Ubuntu
Docker image 2 (in 1): 'virtual machine'
Then I met many problems with this @@
Thanks you so much!

Install compilebox in docker container

I install compilebox by this way:

  • Create CentOS/Ubuntu image: only contains centos/ubunto + folder code
  • Run into container and install in it. But when docker build 'virtual machine', I met many problems. I've solved a few. But now I'm stuck @@:
...
Step 28/35 : RUN apt-get install -y scala
...

...
Errors were encountered while processing:
 libpam-systemd:amd64
 policykit-1
 colord
 policykit-1-gnome
E: Sub-process /usr/bin/dpkg returned an error code (1)

Please help me to resolve this problem. Thank you so much!

Allow for Standard Input When Running Code

Any way you think we could allow for running code that asks for standard input? I would be happy to help code if we can come up with a secure way to do it. Thank you for CompileBox!

Ruby Example:

print "Type in your name: "
name = gets()
puts name

use java custom package

I put the custom package like TestPackage. in API/Payload
and I change the DockerSandbox.js to add cp -r for copy the API/Payload/TestPackage(custom package) and It really copy the folder to temp folder
but when i run the java code
it shows "error: package TestPackage does not exist"
how could i import my custom package in my code?
thank you

Log output when compile fails

Hello,

When I compiling a block code C/C++ within some errors:

  #include "iostream"
  using namespace std;

  int mainccc()
  {
    int n, sum = 0;
    //...
    return 0;
  }

(The error at "int mainccc()")

We will get a message "Compilation Failed".

It is not enough.

How do I get fully message error when compiling?

Thanks.

How to run it ?

Im using a Mac, so I meet all dependencies first and then execute ./UpdateDocker.sh .
What next ? Do I directly enter API folder and run app.js ?

Constantly Timing out

Hey guys,

ran Install_16_.04.sh on digital ocean x64 droplet, installed node etc. When I use the sample client api to do Hello word C file, it keeps timing out the following is the console output when I click the compile button. Extremely weird. Please help!

C/C++ file was saved!
Input file was saved!
/root/compilebox/API/DockerTimeout.sh 20s -u mysql -e 'NODE_PATH=/usr/local/lib/node_modules' -i -t -v "/root/compilebox/API/temp/9589feeead5a4a99db8f":/usercode virtual_machine /usercode/script.sh 'g++ -o /usercode/a.out' file.cpp /usercode/a.out

ATTEMPTING TO REMOVE: temp/9589feeead5a4a99db8f

Timed Out: temp/9589feeead5a4a99db8f C/C++
Time:
undefined

What's the purpose of using mysql in the setup Dockerfile?

Hi, please refer to this code in the setup Dockerfile:
RUN echo "mysql ALL = NOPASSWD: /usr/sbin/service mysql start" | cat >> /etc/sudoers

What's the reason to setting no permissions to a mysql connection? Do we even need a db connection for code compiling service?

Error when 2 Classes in One submission

One can include 2 classes in one submission file locally or on Ideone. When including 2 classes in one Java file on Compilebox, it reports "Execution timed out". For example:

class Main{
    public static void main(String[] args) {
        System.out.println("hello world");
    }
}

class Blob{
    int num;
}

This causes a "timeout error":

Java file was saved!
Input file was saved!
.../DockerTimeout.sh 6s  -u nobody -i -t -v  
".../temp/fa910475be662845df3e":/usercode virtual_machine /usercode/script.sh javac file.java './usercode/javaRunner.sh' 
------------------------------
ATTEMPTING TO REMOVE: temp/fa91...
------------------------------
Timed Out: temp/fa910... Java

Docker Inside Docker

We have app and which will spin the short term (short span) docker containers. Right now, it runs in Ubunut16.04 server (VM) and we installed docker, and nodejs in same server. We have nodejs app which runs in same server so whenever a request comes in, then the nodejs app will spin up a docker container and execute a user input inside the docker container. Once after the docker finish its job or if it runs out of admin defined resources then the docker container will be forcefully killed (docker kill) and removed (docker rm).

Now my question is, is it best practices to run the Ubunte16.04 docker container and run nodjes app and the short term docker containers inside the Ubunuter16.04 docker container.

In short run a docker inside other docker container.

app.js is dead when trying to run following in python

flag = 1
while (flag): 
    print  ('Given flag is really true!')
print "Done"

And error:

ATTEMPTING TO REMOVE: temp/2fe6cc4c7772de1a7581

buffer.js:385
throw new Error('toString failed');
^

Error: toString failed
at Buffer.toString (buffer.js:385:11)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:378:21)

compile not found

I have done a local installation of your code but when I run it from the browser, I get the error "Compile not found" . I have checked the installation and there is no file with the name compile. Could you please suggest what the issue is.

Docker Image is not generating

compilebox/Setup/UpdateDocker.sh: line 3: Dockerfile: No such file or directory
Retrieving Installed Docker Images
REPOSITORY TAG IMAGE ID CREATED SIZE
None None 57d2cfcccb1e 16 hours ago 1.586 GB
chug/ubuntu14.04x64 latest aaaa7bd9d11a 3 years ago 224.7

No Docker Image is generating i have tried the fresh install and checked the permission thing but still its not working.Please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.