2

I am looking into very simple Python webservers such as SimpleHTTPServer / HTTP.Server, but I can't find the answer to this.

Is there a simple webserver that can be compiled into .pyc, or really any kind of file that 1) runs on Debian, and 2) hides its own code?

1 Answer 1

3

You could compile a Python web-server application to a stand-alone binary. Here is an example I just tried, where the standard Python 2 SimpleHTTPServer module is compiled to a stand-alone binary using PyInstaller.

Install PyInstaller:

pip install PyInstaller

Move to a location where you don't mind generating some files:

mkdir /tmp/python-server
cd /tmp/python-server

Generate the binary:

pyinstaller --onefile /usr/lib/python2.7/SimpleHTTPServer.py

Run the generated binary (located in the dist subdirectory):

./dist/SimpleHTTPServer

You should see the server start as if you had run the script using the Python interpreter:

Serving HTTP on 0.0.0.0 port 8000 ...

There are many posts which discuss methods for compiling Python programs to stand-alone executables and which include alternatives to PyInstaller, e.g.:

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.