{"id":13842265,"url":"https://github.com/projectdiscovery/simplehttpserver","last_synced_at":"2025-04-12T21:36:51.029Z","repository":{"id":37101402,"uuid":"323212931","full_name":"projectdiscovery/simplehttpserver","owner":"projectdiscovery","description":"Go alternative of python SimpleHTTPServer","archived":false,"fork":false,"pushed_at":"2024-01-22T10:09:07.000Z","size":199,"stargazers_count":503,"open_issues_count":16,"forks_count":55,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-04-11T16:15:43.706Z","etag":null,"topics":["gohttpserver","simplehttpserver"],"latest_commit_sha":null,"homepage":"https://projectdiscovery.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/projectdiscovery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-21T02:42:35.000Z","updated_at":"2025-04-11T09:30:17.000Z","dependencies_parsed_at":"2024-06-18T19:49:02.423Z","dependency_job_id":"237b6a09-d9e3-47fd-9c51-8c5a0acba7c6","html_url":"https://github.com/projectdiscovery/simplehttpserver","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectdiscovery%2Fsimplehttpserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectdiscovery%2Fsimplehttpserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectdiscovery%2Fsimplehttpserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectdiscovery%2Fsimplehttpserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectdiscovery","download_url":"https://codeload.github.com/projectdiscovery/simplehttpserver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637721,"owners_count":21137534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gohttpserver","simplehttpserver"],"created_at":"2024-08-04T17:01:30.642Z","updated_at":"2025-04-12T21:36:51.009Z","avatar_url":"https://github.com/projectdiscovery.png","language":"Go","funding_links":[],"categories":["Go","开发工具\u0026框架"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSimpleHTTPserver\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003eGo alternative of python SimpleHTTPServer\u003c/h4\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-_red.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/projectdiscovery/simplehttpserver/issues\"\u003e\u003cimg src=\"https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/badge/github.com/projectdiscovery/simplehttpserver\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/projectdiscovery/simplehttpserver\"\u003e\u003c/a\u003e\n\u003ca href=\"https://hub.docker.com/r/projectdiscovery/simplehttpserver\"\u003e\u003cimg src=\"https://img.shields.io/docker/pulls/projectdiscovery/simplehttpserver.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://twitter.com/pdiscoveryio\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/pdiscoveryio.svg?logo=twitter\"\u003e\u003c/a\u003e\n\u003ca href=\"https://discord.gg/projectdiscovery\"\u003e\u003cimg src=\"https://img.shields.io/discord/695645237418131507.svg?logo=discord\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e •\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\n  \u003ca href=\"#installing-simplehttpserver\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#running-simplehttpserver-in-the-current-folder\"\u003eRun SimpleHTTPserver\u003c/a\u003e •\n  \u003ca href=\"https://discord.gg/projectdiscovery\"\u003eJoin Discord\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nSimpleHTTPserver is a go enhanced version of the well known python simplehttpserver with in addition a fully customizable TCP server, both supporting TLS.\n\n\n# Features\n\n- HTTP/S Web Server\n- File Server with arbitrary directory support\n- HTTP request/response dump\n- Configurable ip address and listening port\n- Configurable HTTP/TCP server with customizable response via YAML template\n\n\n# Installing SimpleHTTPserver\n\nSimpleHTTPserver requires **go1.17+** to install successfully. Run the following command to get the repo - \n\n```sh\ngo install -v github.com/projectdiscovery/simplehttpserver/cmd/simplehttpserver@latest\n```\n\n# Usage\n\n```sh\nsimplehttpserver -h\n```\n\nThis will display help for the tool. Here are all the switches it supports.\n\n| Flag             | Description                                             | Example                                            |\n|------------------|---------------------------------------------------------|----------------------------------------------------|\n| `-listen`        | Configure listening ip:port (default 127.0.0.1:8000)    | `simplehttpserver -listen 127.0.0.1:8000`          |\n| `-path`          | Fileserver folder (default current directory)           | `simplehttpserver -path /var/docs`                 |\n| `-verbose`       | Verbose (dump request/response, default false)          | `simplehttpserver -verbose`                        |\n| `-tcp`           | TCP server (default 127.0.0.1:8000)                     | `simplehttpserver -tcp 127.0.0.1:8000`             |\n| `-tls`           | Enable TLS for TCP server                               | `simplehttpserver -tls`                            |\n| `-rules`         | File containing yaml rules                              | `simplehttpserver -rules rule.yaml`                |\n| `-upload`        | Enable file upload in case of http server               | `simplehttpserver -upload`                         |\n| `-max-file-size` | Max Upload File Size (default 50 MB)                    | `simplehttpserver -max-file-size 100`              |\n| `-sandbox`       | Enable sandbox mode                                     | `simplehttpserver -sandbox`                        |\n| `-https`         | Enable HTTPS in case of http server                     | `simplehttpserver -https`                          |\n| `-http1`         | Enable only HTTP1                                       | `simplehttpserver -http1`                          |\n| `-cert`          | HTTPS/TLS certificate (self generated if not specified) | `simplehttpserver -cert cert.pem`                  |\n| `-key`           | HTTPS/TLS certificate private key                       | `simplehttpserver -key cert.key`                   |\n| `-domain`        | Domain name to use for the self-generated certificate   | `simplehttpserver -domain projectdiscovery.io`     |\n| `-cors`          | Enable cross-origin resource sharing (CORS)             | `simplehttpserver -cors`                           |\n| `-basic-auth`    | Basic auth (username:password)                          | `simplehttpserver -basic-auth user:password`       |\n| `-realm`         | Basic auth message                                      | `simplehttpserver -realm \"insert the credentials\"` |\n| `-version`       | Show version                                            | `simplehttpserver -version`                        |\n| `-silent`        | Show only results                                       | `simplehttpserver -silent`                         |\n| `-py`            | Emulate Python Style                                    | `simplehttpserver -py`                             |\n| `-header`        | HTTP response header (can be used multiple times)       | `simplehttpserver -header 'X-Powered-By: Go'`      |\n\n### Running simplehttpserver in the current folder  \n\nThis will run the tool exposing the current directory on port 8000 \n\n```sh\nsimplehttpserver\n\n2021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...\n2021/01/11 21:41:15 [::1]:50181 \"GET / HTTP/1.1\" 200 383\n2021/01/11 21:41:15 [::1]:50181 \"GET /favicon.ico HTTP/1.1\" 404 19\n```\n\n### Running simplehttpserver in the current folder with HTTPS\n\nThis will run the tool exposing the current directory on port 8000 over HTTPS with user provided certificate:\n\n```sh\nsimplehttpserver -https -cert cert.pen -key cert.key\n\n2021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...\n2021/01/11 21:41:15 [::1]:50181 \"GET / HTTP/1.1\" 200 383\n2021/01/11 21:41:15 [::1]:50181 \"GET /favicon.ico HTTP/1.1\" 404 19\n```\n\nInstead, to run with self-signed certificate and specific domain name:\n```sh\nsimplehttpserver -https -domain localhost\n\n2021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...\n2021/01/11 21:41:15 [::1]:50181 \"GET / HTTP/1.1\" 200 383\n2021/01/11 21:41:15 [::1]:50181 \"GET /favicon.ico HTTP/1.1\" 404 19\n```\n\n### Running simplehttpserver with basic auth and file upload\n\nThis will run the tool and will request the user to enter username and password before authorizing file uploads\n\n```sh\nsimplehttpserver -basic-auth root:root -upload\n\n2021/01/11 21:40:48 Serving . on http://0.0.0.0:8000/...\n```\n\nTo upload files use the following curl request with basic auth header:\n```sh\ncurl -v --user 'root:root' --upload-file file.txt http://localhost:8000/file.txt\n```\n\n### Running TCP server with custom responses\n\nThis will run the tool as TLS TCP server and enable custom responses based on YAML templates:\n\n```sh\nsimplehttpserver -rules rules.yaml -tcp -tls -domain localhost\n```\n\nThe rules are written as follows:\n```yaml\nrules:\n  - match: regex-match\n    match-contains: literal-match\n    name: rule-name\n    response: response data\n```\n\nFor example to handle two different paths simulating an HTTP server or SMTP commands:\n```yaml\nrules:\n  # HTTP Requests\n  - match: GET /path1\n    name: redirect\n    response: |\n              HTTP/1.0 200 OK\n              Server: httpd/2.0\n              x-frame-options: SAMEORIGIN\n              x-xss-protection: 1; mode=block\n              Date: Fri, 16 Apr 2021 14:30:32 GMT\n              Content-Type: text/html\n              Connection: close\n\n              \u003cHTML\u003e\u003cHEAD\u003e\u003cscript\u003etop.location.href='/Main_Login.asp';\u003c/script\u003e\n              \u003c/HEAD\u003e\u003c/HTML\u003e\n  - match: GET /path2\n    name: \"404\"\n    response: |\n              HTTP/1.0 404 OK\n              Server: httpd/2.0\n            \n              \u003cHTML\u003e\u003cHEAD\u003e\u003c/HEAD\u003e\u003cBODY\u003eNot found\u003c/BODY\u003e\u003c/HTML\u003e\n  # SMTP Commands\n  - match: \"EHLO example.com\"\n    name: smtp \n    response: |\n              250-localhost Nice to meet you, [127.0.0.1]\n              250-PIPELINING\n              250-8BITMIME\n              250-SMTPUTF8\n              250-AUTH LOGIN PLAIN\n              250 STARTTLS\n  - match: \"MAIL FROM: \u003cnoreply@example.com\u003e\"\n    response: 250 Accepted\n  - match: \"RCPT TO: \u003ctest@example.com\u003e\"\n    response: 250 Accepted\n\n  - match-contains: !!binary |\n      MAwCAQFgBwIBAwQAgAA=\n    name: \"ldap\"\n    # Request:  300c 0201 0160 0702 0103 0400 8000       0....`........\n    # Response: 300c 0201 0161 070a 0100 0400 0400       0....a........\n    response: !!binary |\n      MAwCAQFhBwoBAAQABAA=\n```\n\n## Note\n\n- This project is intended for development purposes only; it should not be used in production.\n\n# Thanks\n\nSimpleHTTPserver is made with 🖤 by the [projectdiscovery](https://projectdiscovery.io) team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectdiscovery%2Fsimplehttpserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectdiscovery%2Fsimplehttpserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectdiscovery%2Fsimplehttpserver/lists"}