A new discovery: SimpleHTTPserver

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.


go install -v github.com/projectdiscovery/simplehttpserver/cmd/simplehttpserver@latest


simplehttpserver -h

-listenConfigure listening ip:port (default -listen
-pathFileserver folder (default current directory)simplehttpserver -path /var/docs
-verboseVerbose (dump request/response, default false)simplehttpserver -verbose
-tcpTCP server (default -tcp
-tlsEnable TLS for TCP serversimplehttpserver -tls
-rulesFile containing yaml rulessimplehttpserver -rules rule.yaml
-uploadEnable file upload in case of http serversimplehttpserver -upload
simplehttpserver -uploadMax Upload File Size (default 50 MB)simplehttpserver -max-file-size 100
-sandboxEnable sandbox modesimplehttpserver -sandbox
-httpsEnable HTTPS in case of http serversimplehttpserver -https
-http1Enable only HTTP1simplehttpserver -http1
-certHTTPS/TLS certificate (self generated if not specified)simplehttpserver -cert cert.pem
-keyHTTPS/TLS certificate private keysimplehttpserver -key cert.key
-domainDomain name to use for the self-generated certificatesimplehttpserver -domain projectdiscovery.io
-corsEnable cross-origin resource sharing (CORS)simplehttpserver -cors
-basic-authBasic auth (username:password)simplehttpserver -basic-auth user:password
-realmBasic auth messagesimplehttpserver -realm «insert the credentials»
-versionShow versionsimplehttpserver -version
-silentShow only resultssimplehttpserver -silent
-pyEmulate Python Stylesimplehttpserver -py
-headerHTTP 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

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

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
[2023-08-19 12:56:42] "PUT /file.txt HTTP/1.1" 201 0
[2023-08-19 12:57:12] "GET / HTTP/1.1" 200 77