Package: ngus
ngusngusis a minimalist HTTP server written in pure Python and intended for
receiving file uploadsMotivationThe reason for writing this small package was the need to transfer files from
a Windows desktop machine running on a highly restricted VPN to my GNU and UNIX
systems.Since the HTTP traffic (out) was not restricted, I started looking for a small
, yet flexible HTTP server that could satisfy the following criteria:can be configured with the help of a few CLI parameterscan be started and stopped quickly by an unprivileged userbe able to receive uploads to a specific directorybe portable and require a minimal amount of dependenciesbe part of the C/C++ or Python ecosystemsTo my amazement I wasn't able to find any free software matching that criteria.OverviewThe main purpose ofngusis to accept file uploads as POST requests from an
HTTP client.Currentlyngusdoes not provide encryption (HTTPS) support. Many different
tools can be employed to serve as an HTTPS proxy.See the examples bellow for more details!Installationpip (pypi)pipinstallngusGentoolayman-asgs
emergewww-servers/ngusExamplesWhen installingngusas described above, a dedicatedngusscript
(entry point) will be installed in addition to thengusPython module.Running:ngus-hwill be for all practical purposes the same as running:python-mngus-hThe latter format will be used for the rest of this section.python-mngus-H0.0.0.0-p8080will start the server, binding port 8080 on all available interfaces and
storing the received uploads in the current working directory (CWD), whilepython-mngus-H0.0.0.0-p8080-u/home/s/uploadswill store them in/home/s/uploadsNote:This will allowngusto replace any existing file in this directory.Once the server is running a client will be able to send a POST form with a
file data. One can always access the URL (send a GET request) with a regular
browser and use the provided form or simply use a client likecurlfor
posting (sending a POST request) a form.curl-F"ufile=@myfile.zip"http://158.39.125.240:8080The default form input field name isufile. That can be changed by using the--input-nameparameter. Basic auth support can be added with the--basic-authparameter.python-mngus-H0.0.0.0-p8080-iuploadfile-b"uname:foo"-u/home/s/uploads
curl--basic-uuname-F"uploadfile=@myfile.zip"http://158.39.125.240:8080Usingnginxas a proxynguswill usually not be run on ports 80 (HTTP) and 443 (HTTPS) since binding
them requires administrator (root) privileges.Runningnguson a unprivileged port (> 1024) may not solve the problem
described above. Namely a potential client may not be able to communicate to
ports other than 80 and 443 because of imposed firewall / VPN restrictions.Another potential challenge arises whenngusruns on a host that is not
publicly accessible.nginxcan be used to proxy the traffic towardngusinstance running as
described in the examples above.server{listen443ssl;listen80;server_nameuploads.myhostname.net;access_log/var/log/nginx/uploads.myhostname.net.access.log;error_log/var/log/nginx/uploads.myhostname.net.error.logerror;ssl_certificateuploads.myhostname.net.cert.pem;ssl_certificate_keyuploads.myhostname.net.key.pem;location/{# point at the ngus instance running on a private network addressproxy_passhttp://192.168.1.240:8080/;}}... and then upload a file with:curl-F"ufile=@myfile.zip"https://uploads.myhostname.netSupport and contributingngus is hosted on GitHub:https://github.com/blackm0re/ngusAuthorSimeon Simeonov - sgs @ LiberaChatLicenseCopyright (c) 2021, Simeon Simeonov
All rights reserved.Licensedunder the
GNU General Public License v3.0 or later.
SPDX-License-Identifier: GPL-3.0-or-later