SimpleHTTPserver is a go enhanced version of the well known python simplehttpserver with in addition a fully customizable TCP server, both supporting TLS.
It will be a handy tool during your pentests.
Installing
go install -v github.com/projectdiscovery/simplehttpserver/cmd/simplehttpserver@latest
Help
simplehttpserver -h
Flag | Description | Example |
-listen | Configure listening ip:port (default 127.0.0.1:8000) | simplehttpserver -listen 127.0.0.1:8000 |
-path | Fileserver folder (default current directory) | simplehttpserver -path /var/docs |
-verbose | Verbose (dump request/response, default false) | simplehttpserver -verbose |
-tcp | TCP server (default 127.0.0.1:8000) | simplehttpserver -tcp 127.0.0.1:8000 |
-tls | Enable TLS for TCP server | simplehttpserver -tls |
-rules | File containing yaml rules | simplehttpserver -rules rule.yaml |
-upload | Enable file upload in case of http server | simplehttpserver -upload |
simplehttpserver -upload | Max Upload File Size (default 50 MB) | simplehttpserver -max-file-size 100 |
-sandbox | Enable sandbox mode | simplehttpserver -sandbox |
-https | Enable HTTPS in case of http server | simplehttpserver -https |
-http1 | Enable only HTTP1 | simplehttpserver -http1 |
-cert | HTTPS/TLS certificate (self generated if not specified) | simplehttpserver -cert cert.pem |
-key | HTTPS/TLS certificate private key | simplehttpserver -key cert.key |
-domain | Domain name to use for the self-generated certificate | simplehttpserver -domain projectdiscovery.io |
-cors | Enable cross-origin resource sharing (CORS) | simplehttpserver -cors |
-basic-auth | Basic auth (username:password) | simplehttpserver -basic-auth user:password |
-realm | Basic auth message | simplehttpserver -realm «insert the credentials» |
-version | Show version | simplehttpserver -version |
-silent | Show only results | simplehttpserver -silent |
-py | Emulate Python Style | simplehttpserver -py |
-header | HTTP response header (can be used multiple times) | simplehttpserver -header ‘X-Powered-By: Go’ |
Usage examples
Running simplehttpserver in the current folder
$ simplehttpserver
...
Serving /home/ruben/tmp/folder on http://0.0.0.0:8000/
...
Running simplehttpserver in the current folder with HTTPS
$ simplehttpserver -https -cert cert.pen -key cert.key
$ simplehttpserver -https -domain localhost
...
Serving /home/ruben/tmp/folder on https://0.0.0.0:8000/
...
Running simplehttpserver with basic auth and file upload
simplehttpserver -basic-auth root:root -upload
curl -v --user 'root:root' --upload-file file.txt http://localhost:8000/file.txt

Serving /home/ruben/tmp/folder on http://0.0.0.0:8000/
...
[2023-08-19 12:56:42] 127.0.0.1:53762 "PUT /file.txt HTTP/1.1" 201 0
[2023-08-19 12:57:12] 127.0.0.1:39282 "GET / HTTP/1.1" 200 77
