@@ -26,9 +26,9 @@ SimpleHTTPserver is a go enhanced version of the well known python simplehttpser
2626
2727# Features
2828
29- - HTTPS support
30- - File server in arbitrary directory
31- - Full request/response dump
29+ - HTTP/S Web Server
30+ - File Server with arbitrary directory support
31+ - HTTP request/response dump
3232- Configurable ip address and listening port
3333- Configurable HTTP/TCP server with customizable response via YAML template
3434
@@ -38,7 +38,7 @@ SimpleHTTPserver is a go enhanced version of the well known python simplehttpser
3838SimpleHTTPserver requires ** go1.14+** to install successfully. Run the following command to get the repo -
3939
4040``` sh
41- ▶ GO111MODULE=on go get -v github.com/projectdiscovery/simplehttpserver/cmd/simplehttpserver
41+ GO111MODULE=on go get -v github.com/projectdiscovery/simplehttpserver/cmd/simplehttpserver
4242```
4343
4444# Usage
@@ -49,30 +49,33 @@ simplehttpserver -h
4949
5050This will display help for the tool. Here are all the switches it supports.
5151
52- | Flag | Description | Example |
53- | ----------- | -------------------------------------------------------------------- | ------------------------------------------------- |
54- | listen | Configure listening ip: port (default 127.0.0.1:8000) | simplehttpserver -listen 127.0.0.1:8000 |
55- | path | Fileserver folder (default current directory) | simplehttpserver -path /var/docs |
56- | verbose | Verbose (dump request/response, default false) | simplehttpserver -verbose |
57- | tcp | TCP server (default 127.0.0.1:8000) | simplehttpserver -tcp 127.0.0.1:8000 |
58- | tls | Enable TLS for TCP server | simplehttpserver -tls |
59- | rules | File containing yaml rules | simplehttpserver -rules rule.yaml |
60- | upload | Enable file upload in case of http server | simplehttpserver -upload |
61- | https | Enable HTTPS in case of http server | simplehttpserver -https |
62- | cert | HTTPS/TLS certificate (self generated if not specified) | simplehttpserver -cert cert.pem |
63- | key | HTTPS/TLS certificate private key (self generated if not specified) | simplehttpserver -key cert.key |
64- | domain | Domain name to use for the self-generated certificate | simplehttpserver -domain projectdiscovery.io |
65- | basic-auth | Basic auth (username: password ) | simplehttpserver -basic-auth user: password |
66- | realm | Basic auth message | simplehttpserver -realm "insert the credentials" |
67- | version | Show version | simplehttpserver -version |
68- | silent | Show only results | simplehttpserver -silent |
52+ | Flag | Description | Example |
53+ | ------------- | ------------------------------------------------------- | ------------------------------------------------ |
54+ | listen | Configure listening ip: port (default 127.0.0.1:8000) | simplehttpserver -listen 127.0.0.1:8000 |
55+ | path | Fileserver folder (default current directory) | simplehttpserver -path /var/docs |
56+ | verbose | Verbose (dump request/response, default false) | simplehttpserver -verbose |
57+ | tcp | TCP server (default 127.0.0.1:8000) | simplehttpserver -tcp 127.0.0.1:8000 |
58+ | tls | Enable TLS for TCP server | simplehttpserver -tls |
59+ | rules | File containing yaml rules | simplehttpserver -rules rule.yaml |
60+ | upload | Enable file upload in case of http server | simplehttpserver -upload |
61+ | max-file-size | Max Upload File Size (default 50 MB) | simplehttpserver -max-file-size 100 |
62+ | sandbox | Enable sandbox mode | simplehttpserver -sandbox |
63+ | https | Enable HTTPS in case of http server | simplehttpserver -https |
64+ | cert | HTTPS/TLS certificate (self generated if not specified) | simplehttpserver -cert cert.pem |
65+ | key | HTTPS/TLS certificate private key | simplehttpserver -key cert.key |
66+ | domain | Domain name to use for the self-generated certificate | simplehttpserver -domain projectdiscovery.io |
67+ | basic-auth | Basic auth (username: password ) | simplehttpserver -basic-auth user: password |
68+ | realm | Basic auth message | simplehttpserver -realm "insert the credentials" |
69+ | version | Show version | simplehttpserver -version |
70+ | silent | Show only results | simplehttpserver -silent |
6971
7072### Running simplehttpserver in the current folder
7173
7274This will run the tool exposing the current directory on port 8000
7375
7476``` sh
75- ▶ simplehttpserver
77+ simplehttpserver
78+
76792021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...
77802021/01/11 21:41:15 [::1]:50181 " GET / HTTP/1.1" 200 383
78812021/01/11 21:41:15 [::1]:50181 " GET /favicon.ico HTTP/1.1" 404 19
@@ -83,15 +86,17 @@ This will run the tool exposing the current directory on port 8000
8386This will run the tool exposing the current directory on port 8000 over HTTPS with user provided certificate:
8487
8588``` sh
86- ▶ simplehttpserver -https -cert cert.pen -key cert.key
89+ simplehttpserver -https -cert cert.pen -key cert.key
90+
87912021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...
88922021/01/11 21:41:15 [::1]:50181 " GET / HTTP/1.1" 200 383
89932021/01/11 21:41:15 [::1]:50181 " GET /favicon.ico HTTP/1.1" 404 19
9094```
9195
9296Instead, to run with self-signed certificate and specific domain name:
9397``` sh
94- ▶ simplehttpserver -https -domain localhost
98+ simplehttpserver -https -domain localhost
99+
951002021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...
961012021/01/11 21:41:15 [::1]:50181 " GET / HTTP/1.1" 200 383
971022021/01/11 21:41:15 [::1]:50181 " GET /favicon.ico HTTP/1.1" 404 19
@@ -102,21 +107,22 @@ Instead, to run with self-signed certificate and specific domain name:
102107This will run the tool and will request the user to enter username and password before authorizing file uploads
103108
104109``` sh
105- ▶ simplehttpserver -basic-auth root:root -upload
110+ simplehttpserver -basic-auth root:root -upload
111+
1061122021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...
107113```
108114
109115To upload files use the following curl request with basic auth header:
110116``` sh
111- ▶ curl -v --user ' root:root' --upload-file file.txt http://localhost:8000/file.txt
117+ curl -v --user ' root:root' --upload-file file.txt http://localhost:8000/file.txt
112118```
113119
114120### Running TCP server with custom responses
115121
116122This will run the tool as TLS TCP server and enable custom responses based on YAML templates:
117123
118124``` sh
119- ▶ simplehttpserver -rule rules.yaml -tcp -tls -domain localhost
125+ simplehttpserver -rule rules.yaml -tcp -tls -domain localhost
120126```
121127
122128The rules are written as follows:
0 commit comments