Computer Science Canada

What is the best way for a web server to run command line scripts?

Author:  BigBear [ Thu Feb 07, 2013 9:38 am ]
Post subject:  What is the best way for a web server to run command line scripts?

If you were to create a web application that will

prompt the user
to select compilers or compiler versions
to select compiler settings
to select a program to compile

and display the size of the compiled program with each of the compilers and settings.

I am thinking it will need to run either a python script or maybe even just a make script.

Which language/framework would you recommend?

Author:  QuantumPhysics [ Fri Feb 08, 2013 12:00 pm ]
Post subject:  RE:What is the best way for a web server to run command line scripts?

Django = the web scripting side of python.

Author:  Tony [ Fri Feb 08, 2013 1:08 pm ]
Post subject:  RE:What is the best way for a web server to run command line scripts?

Flask is also a good web framework for Python.

Author:  rdrake [ Sat Feb 09, 2013 2:10 am ]
Post subject:  Re: RE:What is the best way for a web server to run command line scripts?

Tony @ Fri Feb 08, 2013 1:08 pm wrote:
Flask is also a good web framework for Python.
Seconding.

Flask is much smaller and flexible. Combine it with sh and you have yourself a winner.

Author:  btiffin [ Sun Feb 10, 2013 2:51 am ]
Post subject:  RE:What is the best way for a web server to run command line scripts?

Old guy interrupting;
Go team Pocoo (Flask).

Old guy bragging;
Had a pull request accepted into Pygments, so I get to pretend to be a contributor to team Pocoo. Go Georg.

Cheers

Author:  Dan [ Mon Feb 11, 2013 11:03 am ]
Post subject:  RE:What is the best way for a web server to run command line scripts?

You have to be rather careful when having a web application execute commands that the user has some control over or you can run in to security issues rather fast.

If your web server is running as root, this could give them total access to the server. I highly recommend ensuring that your web server is chrooted or not running as root and you take care to escape any input coming from the user.

If you are allowing users to upload code to be complied and then executing that code, I highly recommend to take steps to ensure they can't cause any damage. chrooting or running the code in a VM might be a good option but you might also want to consider separating the front end web application from the backend that complies and runs the program.


: