[![Python](https://img.shields.io/pypi/pyversions/shell2http.svg)](https://badge.fury.io/py/shell2http)
[![PyPI](https://badge.fury.io/py/shell2http.svg)](https://badge.fury.io/py/shell2http)
# shell2http
HTTP-server to execute shell commands. Designed for development, prototyping or remote control. Settings through two command line arguments, path and shell command. By default bind to :8080. with [shell2udp](https://github.com/GitHub30/shell2udp) it runs with minimal latency.
# Usage
```bash
shell2http [-h] [-form] [-no-index] [-add-exit] [-output] [-sse] [-p PORT] ["shell command" for /] /path "shell command" /path2 "shell command2" ...
positional arguments:
command
optional arguments:
-h, --help show this help message and exit
-form parse query into environment vars
-no-index do not generate index page
-add-exit add /exit command
-output send back output
-sse use Server Sent Events
-p PORT, --port PORT
```
# Install
```bash
pip install shell2http
```
# Examples
## Windows
stop http server with `Ctrl` + `Pause/Break`
```powershell
shell2http "shutdown -s -t 0"
```
```powershell
shell2http "shutdown -s -t 0" /beep "powershell -c echo `a"
```
```powershell
shell2http --port 3306 /beep "powershell -command [Console]::Beep(440,2000)"
```
http://localhost:8080/form?from=10&to=100
```bash
shell2http -output -form /form 'echo %v_from%, %v_to%'
```
## Linux
```bash
shell2http 'notify-send Hello root'
```
```bash
shell2http -p3000 'notify-send Hello root' /path 'canberra-gtk-play -i desktop-login'
```
```bash
shell2http -p3000 /path 'canberra-gtk-play -i desktop-login'
```
```bash
shell2http -output /info 'uname -a'
```
```bash
shell2http -output -sse /ping 'ping -c4 8.8.8.8'
```
```bash
shell2http -add-exit pwd
```
http://localhost:8080/form?from=10&to=100
```bash
shell2http -output -form /form 'echo $v_from, $v_to'
```
html sufix to endpoint will change header to "text/html":
```bash
# Ability to have server events and server simple html pages as clients
shell2http -output -sse /serve_files_as.html "cat LICENSE|sed 's/.*/<pre>&<\/pre>/'"
```
# Acknowledgements
https://github.com/msoap/shell2http
https://github.com/eshaan7/Flask-Shell2HTTP
Raw data
{
"_id": null,
"home_page": "https://github.com/GitHub30/shell2http",
"name": "shell2http",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "shell2http subprocess python",
"author": "Tomofumi Inoue",
"author_email": "funaox@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a3/c2/816e6538a5e7957801b6bbd07de6d89d1cac921d96f378f7dafe34dd3635/shell2http-2.10.tar.gz",
"platform": "any",
"description": "[![Python](https://img.shields.io/pypi/pyversions/shell2http.svg)](https://badge.fury.io/py/shell2http)\n[![PyPI](https://badge.fury.io/py/shell2http.svg)](https://badge.fury.io/py/shell2http)\n\n# shell2http\nHTTP-server to execute shell commands. Designed for development, prototyping or remote control. Settings through two command line arguments, path and shell command. By default bind to :8080. with [shell2udp](https://github.com/GitHub30/shell2udp) it runs with minimal latency.\n\n# Usage\n\n```bash\nshell2http [-h] [-form] [-no-index] [-add-exit] [-output] [-sse] [-p PORT] [\"shell command\" for /] /path \"shell command\" /path2 \"shell command2\" ...\n\npositional arguments:\n command\n\noptional arguments:\n -h, --help show this help message and exit\n -form parse query into environment vars\n -no-index do not generate index page\n -add-exit add /exit command\n -output send back output\n -sse use Server Sent Events\n -p PORT, --port PORT\n```\n\n# Install\n\n```bash\npip install shell2http\n```\n\n# Examples\n\n## Windows\n\nstop http server with `Ctrl` + `Pause/Break`\n\n```powershell\nshell2http \"shutdown -s -t 0\"\n```\n\n```powershell\nshell2http \"shutdown -s -t 0\" /beep \"powershell -c echo `a\"\n```\n\n```powershell\nshell2http --port 3306 /beep \"powershell -command [Console]::Beep(440,2000)\"\n```\n\nhttp://localhost:8080/form?from=10&to=100\n\n```bash\nshell2http -output -form /form 'echo %v_from%, %v_to%'\n```\n\n## Linux\n\n```bash\nshell2http 'notify-send Hello root'\n```\n\n\n```bash\nshell2http -p3000 'notify-send Hello root' /path 'canberra-gtk-play -i desktop-login'\n```\n\n```bash\nshell2http -p3000 /path 'canberra-gtk-play -i desktop-login'\n```\n\n```bash\nshell2http -output /info 'uname -a'\n```\n\n```bash\nshell2http -output -sse /ping 'ping -c4 8.8.8.8'\n```\n\n```bash\nshell2http -add-exit pwd\n```\n\nhttp://localhost:8080/form?from=10&to=100\n\n```bash\nshell2http -output -form /form 'echo $v_from, $v_to'\n```\n\nhtml sufix to endpoint will change header to \"text/html\":\n```bash\n# Ability to have server events and server simple html pages as clients\nshell2http -output -sse /serve_files_as.html \"cat LICENSE|sed 's/.*/<pre>&<\\/pre>/'\"\n```\n\n# Acknowledgements\n\nhttps://github.com/msoap/shell2http\n\nhttps://github.com/eshaan7/Flask-Shell2HTTP\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Executing shell commands via HTTP server",
"version": "2.10",
"split_keywords": [
"shell2http",
"subprocess",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ff74fe670cebe5ccae8b6594408c88eb3ba78231bd26e08e8514531075416f5b",
"md5": "98905b677eccb5884a804c0b0ca096b4",
"sha256": "942f257b50cc99806d43444b4b3acc2d940e803f7ccab248bf117cf3f57079a2"
},
"downloads": -1,
"filename": "shell2http-2.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "98905b677eccb5884a804c0b0ca096b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4578,
"upload_time": "2023-01-03T09:04:30",
"upload_time_iso_8601": "2023-01-03T09:04:30.531459Z",
"url": "https://files.pythonhosted.org/packages/ff/74/fe670cebe5ccae8b6594408c88eb3ba78231bd26e08e8514531075416f5b/shell2http-2.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a3c2816e6538a5e7957801b6bbd07de6d89d1cac921d96f378f7dafe34dd3635",
"md5": "926953cf826aff9e51475ca3c277f71b",
"sha256": "0ebec6c45c9ed82c983f4424e76a5de34d06fa188db5c8e1ed27b81ebed991d1"
},
"downloads": -1,
"filename": "shell2http-2.10.tar.gz",
"has_sig": false,
"md5_digest": "926953cf826aff9e51475ca3c277f71b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4218,
"upload_time": "2023-01-03T09:04:31",
"upload_time_iso_8601": "2023-01-03T09:04:31.711764Z",
"url": "https://files.pythonhosted.org/packages/a3/c2/816e6538a5e7957801b6bbd07de6d89d1cac921d96f378f7dafe34dd3635/shell2http-2.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-03 09:04:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "GitHub30",
"github_project": "shell2http",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "shell2http"
}