pywebexec 1.2.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- pywebexec-1.2.4/.github/workflows/python-publish.yml +39 -0
- pywebexec-1.2.4/.gitignore +172 -0
- pywebexec-1.2.4/LICENSE +21 -0
- pywebexec-1.2.4/PKG-INFO +171 -0
- pywebexec-1.2.4/README.md +109 -0
- pywebexec-1.2.4/pyproject.toml +59 -0
- pywebexec-1.2.4/pywebexec/__init__.py +5 -0
- pywebexec-1.2.4/pywebexec/pywebexec.py +595 -0
- pywebexec-1.2.4/pywebexec/static/css/style.css +178 -0
- pywebexec-1.2.4/pywebexec/static/css/xterm.css +209 -0
- pywebexec-1.2.4/pywebexec/static/images/aborted.svg +1 -0
- pywebexec-1.2.4/pywebexec/static/images/copy.svg +1 -0
- pywebexec-1.2.4/pywebexec/static/images/copy_ok.svg +1 -0
- pywebexec-1.2.4/pywebexec/static/images/failed.svg +1 -0
- pywebexec-1.2.4/pywebexec/static/images/favicon.svg +1 -0
- pywebexec-1.2.4/pywebexec/static/images/running.gif +0 -0
- pywebexec-1.2.4/pywebexec/static/images/success.svg +1 -0
- pywebexec-1.2.4/pywebexec/static/js/script.js +280 -0
- pywebexec-1.2.4/pywebexec/static/js/xterm/LICENSE +21 -0
- pywebexec-1.2.4/pywebexec/static/js/xterm/ansi_up.min.js +7 -0
- pywebexec-1.2.4/pywebexec/static/js/xterm/xterm-addon-fit.js +1 -0
- pywebexec-1.2.4/pywebexec/static/js/xterm/xterm.js +1 -0
- pywebexec-1.2.4/pywebexec/templates/__init__.py +0 -0
- pywebexec-1.2.4/pywebexec/templates/index.html +48 -0
- pywebexec-1.2.4/pywebexec/version.py +16 -0
- pywebexec-1.2.4/pywebexec.egg-info/PKG-INFO +171 -0
- pywebexec-1.2.4/pywebexec.egg-info/SOURCES.txt +31 -0
- pywebexec-1.2.4/pywebexec.egg-info/dependency_links.txt +1 -0
- pywebexec-1.2.4/pywebexec.egg-info/entry_points.txt +2 -0
- pywebexec-1.2.4/pywebexec.egg-info/requires.txt +6 -0
- pywebexec-1.2.4/pywebexec.egg-info/top_level.txt +1 -0
- pywebexec-1.2.4/setup.cfg +7 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
3
|
+
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
5
|
+
# They are provided by a third-party and are governed by
|
6
|
+
# separate terms of service, privacy policy, and support
|
7
|
+
# documentation.
|
8
|
+
|
9
|
+
name: Upload Python Package
|
10
|
+
|
11
|
+
on:
|
12
|
+
release:
|
13
|
+
types: [published]
|
14
|
+
|
15
|
+
permissions:
|
16
|
+
contents: read
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
deploy:
|
20
|
+
|
21
|
+
runs-on: ubuntu-latest
|
22
|
+
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v4
|
25
|
+
- name: Set up Python
|
26
|
+
uses: actions/setup-python@v3
|
27
|
+
with:
|
28
|
+
python-version: '3.x'
|
29
|
+
- name: Install dependencies
|
30
|
+
run: |
|
31
|
+
python -m pip install --upgrade pip
|
32
|
+
pip install build
|
33
|
+
- name: Build package
|
34
|
+
run: python -m build
|
35
|
+
- name: Publish package
|
36
|
+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
37
|
+
with:
|
38
|
+
user: __token__
|
39
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
2
|
+
__pycache__/
|
3
|
+
*.py[cod]
|
4
|
+
*$py.class
|
5
|
+
|
6
|
+
# C extensions
|
7
|
+
*.so
|
8
|
+
|
9
|
+
# Distribution / packaging
|
10
|
+
.Python
|
11
|
+
build/
|
12
|
+
develop-eggs/
|
13
|
+
dist/
|
14
|
+
downloads/
|
15
|
+
eggs/
|
16
|
+
.eggs/
|
17
|
+
lib/
|
18
|
+
lib64/
|
19
|
+
parts/
|
20
|
+
sdist/
|
21
|
+
var/
|
22
|
+
wheels/
|
23
|
+
share/python-wheels/
|
24
|
+
*.egg-info/
|
25
|
+
.installed.cfg
|
26
|
+
*.egg
|
27
|
+
MANIFEST
|
28
|
+
|
29
|
+
# PyInstaller
|
30
|
+
# Usually these files are written by a python script from a template
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32
|
+
*.manifest
|
33
|
+
*.spec
|
34
|
+
|
35
|
+
# Installer logs
|
36
|
+
pip-log.txt
|
37
|
+
pip-delete-this-directory.txt
|
38
|
+
|
39
|
+
# Unit test / coverage reports
|
40
|
+
htmlcov/
|
41
|
+
.tox/
|
42
|
+
.nox/
|
43
|
+
.coverage
|
44
|
+
.coverage.*
|
45
|
+
.cache
|
46
|
+
nosetests.xml
|
47
|
+
coverage.xml
|
48
|
+
*.cover
|
49
|
+
*.py,cover
|
50
|
+
.hypothesis/
|
51
|
+
.pytest_cache/
|
52
|
+
cover/
|
53
|
+
|
54
|
+
# Translations
|
55
|
+
*.mo
|
56
|
+
*.pot
|
57
|
+
|
58
|
+
# Django stuff:
|
59
|
+
*.log
|
60
|
+
local_settings.py
|
61
|
+
db.sqlite3
|
62
|
+
db.sqlite3-journal
|
63
|
+
|
64
|
+
# Flask stuff:
|
65
|
+
instance/
|
66
|
+
.webassets-cache
|
67
|
+
|
68
|
+
# Scrapy stuff:
|
69
|
+
.scrapy
|
70
|
+
|
71
|
+
# Sphinx documentation
|
72
|
+
docs/_build/
|
73
|
+
|
74
|
+
# PyBuilder
|
75
|
+
.pybuilder/
|
76
|
+
target/
|
77
|
+
|
78
|
+
# Jupyter Notebook
|
79
|
+
.ipynb_checkpoints
|
80
|
+
|
81
|
+
# IPython
|
82
|
+
profile_default/
|
83
|
+
ipython_config.py
|
84
|
+
|
85
|
+
# pyenv
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
88
|
+
# .python-version
|
89
|
+
|
90
|
+
# pipenv
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94
|
+
# install all needed dependencies.
|
95
|
+
#Pipfile.lock
|
96
|
+
|
97
|
+
# UV
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100
|
+
# commonly ignored for libraries.
|
101
|
+
#uv.lock
|
102
|
+
|
103
|
+
# poetry
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
106
|
+
# commonly ignored for libraries.
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
108
|
+
#poetry.lock
|
109
|
+
|
110
|
+
# pdm
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
112
|
+
#pdm.lock
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
114
|
+
# in version control.
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
116
|
+
.pdm.toml
|
117
|
+
.pdm-python
|
118
|
+
.pdm-build/
|
119
|
+
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
121
|
+
__pypackages__/
|
122
|
+
|
123
|
+
# Celery stuff
|
124
|
+
celerybeat-schedule
|
125
|
+
celerybeat.pid
|
126
|
+
|
127
|
+
# SageMath parsed files
|
128
|
+
*.sage.py
|
129
|
+
|
130
|
+
# Environments
|
131
|
+
.env
|
132
|
+
.venv
|
133
|
+
env/
|
134
|
+
venv/
|
135
|
+
ENV/
|
136
|
+
env.bak/
|
137
|
+
venv.bak/
|
138
|
+
|
139
|
+
# Spyder project settings
|
140
|
+
.spyderproject
|
141
|
+
.spyproject
|
142
|
+
|
143
|
+
# Rope project settings
|
144
|
+
.ropeproject
|
145
|
+
|
146
|
+
# mkdocs documentation
|
147
|
+
/site
|
148
|
+
|
149
|
+
# mypy
|
150
|
+
.mypy_cache/
|
151
|
+
.dmypy.json
|
152
|
+
dmypy.json
|
153
|
+
|
154
|
+
# Pyre type checker
|
155
|
+
.pyre/
|
156
|
+
|
157
|
+
# pytype static type analyzer
|
158
|
+
.pytype/
|
159
|
+
|
160
|
+
# Cython debug symbols
|
161
|
+
cython_debug/
|
162
|
+
|
163
|
+
# PyCharm
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
168
|
+
#.idea/
|
169
|
+
|
170
|
+
# PyPI configuration file
|
171
|
+
.pypirc
|
172
|
+
pywebexec/version.py
|
pywebexec-1.2.4/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 joknarf
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
pywebexec-1.2.4/PKG-INFO
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: pywebexec
|
3
|
+
Version: 1.2.4
|
4
|
+
Summary: Simple Python HTTP Exec Server
|
5
|
+
Home-page: https://github.com/joknarf/pywebexec
|
6
|
+
Author: Franck Jouvanceau
|
7
|
+
Maintainer: Franck Jouvanceau
|
8
|
+
License: MIT License
|
9
|
+
|
10
|
+
Copyright (c) 2025 joknarf
|
11
|
+
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
14
|
+
in the Software without restriction, including without limitation the rights
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
17
|
+
furnished to do so, subject to the following conditions:
|
18
|
+
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
20
|
+
copies or substantial portions of the Software.
|
21
|
+
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
28
|
+
SOFTWARE.
|
29
|
+
|
30
|
+
Project-URL: Homepage, https://github.com/joknarf/pywebexec
|
31
|
+
Project-URL: Documentation, https://github.com/joknarf/pywebexec/blob/main/README.md
|
32
|
+
Project-URL: Repository, https://github.com/joknarf/pywebexec.git
|
33
|
+
Keywords: http,server,remote commands,api,website
|
34
|
+
Classifier: Development Status :: 5 - Production/Stable
|
35
|
+
Classifier: Intended Audience :: System Administrators
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
37
|
+
Classifier: Operating System :: POSIX
|
38
|
+
Classifier: Operating System :: Unix
|
39
|
+
Classifier: Operating System :: Microsoft :: Windows
|
40
|
+
Classifier: Operating System :: MacOS
|
41
|
+
Classifier: Programming Language :: Python
|
42
|
+
Classifier: Programming Language :: Python :: 3
|
43
|
+
Classifier: Programming Language :: Python :: 3.6
|
44
|
+
Classifier: Programming Language :: Python :: 3.7
|
45
|
+
Classifier: Programming Language :: Python :: 3.8
|
46
|
+
Classifier: Programming Language :: Python :: 3.9
|
47
|
+
Classifier: Programming Language :: Python :: 3.10
|
48
|
+
Classifier: Programming Language :: Python :: 3.11
|
49
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
50
|
+
Classifier: Topic :: System :: Clustering
|
51
|
+
Classifier: Topic :: System :: Networking
|
52
|
+
Classifier: Topic :: System :: Systems Administration
|
53
|
+
Requires-Python: >=3.6
|
54
|
+
Description-Content-Type: text/markdown
|
55
|
+
License-File: LICENSE
|
56
|
+
Requires-Dist: python-daemon>=2.3.2
|
57
|
+
Requires-Dist: cryptography>=40.0.2
|
58
|
+
Requires-Dist: Flask>=2.0.3
|
59
|
+
Requires-Dist: Flask-HTTPAuth>=4.8.0
|
60
|
+
Requires-Dist: gunicorn>=21.2.0
|
61
|
+
Requires-Dist: ldap3>=2.9.1
|
62
|
+
|
63
|
+
[![Pypi version](https://img.shields.io/pypi/v/pywebexec.svg)](https://pypi.org/project/pywebexec/)
|
64
|
+
![example](https://github.com/joknarf/pywebexec/actions/workflows/python-publish.yml/badge.svg)
|
65
|
+
[![Licence](https://img.shields.io/badge/licence-MIT-blue.svg)](https://shields.io/)
|
66
|
+
[![PyPI Downloads](https://static.pepy.tech/badge/pywebexec)](https://pepy.tech/projects/pywebexec)
|
67
|
+
[![Python versions](https://img.shields.io/badge/python-3.6+-blue.svg)](https://shields.io/)
|
68
|
+
|
69
|
+
# pywebexec
|
70
|
+
Simple Python HTTP(S) API/Web Command Launcher
|
71
|
+
|
72
|
+
## Install
|
73
|
+
```
|
74
|
+
$ pip install pywebexec
|
75
|
+
```
|
76
|
+
|
77
|
+
## Quick start
|
78
|
+
|
79
|
+
* put in a directory the scripts/commands/links to commands you want to expose
|
80
|
+
* start http server serving current directory executables listening on 0.0.0.0 port 8080
|
81
|
+
```shell
|
82
|
+
$ pywebexec
|
83
|
+
```
|
84
|
+
|
85
|
+
* Launch commands with params/view live output/Status using browser
|
86
|
+
![pywebexecnew4](https://github.com/user-attachments/assets/55e9058c-d2d9-470e-b3ea-60b10dfc7fce)
|
87
|
+
|
88
|
+
all commands output / statuses are available in the executables directory in subdirectory `.web_status`
|
89
|
+
|
90
|
+
## features
|
91
|
+
|
92
|
+
* Serve executables in a directory
|
93
|
+
* Launch commands with params from web browser or API call
|
94
|
+
* Follow live output
|
95
|
+
* Stop command
|
96
|
+
* Relaunch command
|
97
|
+
* HTTPS support
|
98
|
+
* HTTPS self-signed certificate generator
|
99
|
+
* Basic Auth
|
100
|
+
* LDAP(S)
|
101
|
+
* Can be started as a daemon (POSIX)
|
102
|
+
* Uses gunicorn to serve http/https
|
103
|
+
* Linux/MacOS compatible
|
104
|
+
|
105
|
+
## Customize server
|
106
|
+
```shell
|
107
|
+
$ pywebexec --dir ~/myscripts --listen 0.0.0.0 --port 8080 --title myscripts
|
108
|
+
$ pywebexec -d ~/myscripts -l 0.0.0.0 -p 8080 -t myscripts
|
109
|
+
```
|
110
|
+
|
111
|
+
## Basic auth
|
112
|
+
|
113
|
+
* single user/password
|
114
|
+
```shell
|
115
|
+
$ pywebexec --user myuser [--password mypass]
|
116
|
+
$ pywebexec -u myuser [-P mypass]
|
117
|
+
```
|
118
|
+
Generated password is given if no `--pasword` option
|
119
|
+
|
120
|
+
* ldap(s) password check / group member
|
121
|
+
```shell
|
122
|
+
$ export PYWEBEXEC_LDAP_SERVER=ldap://ldap.forumsys.com:389
|
123
|
+
$ export PYWEBEXEC_LDAP_BIND_DN="cn=read-only-admin,dc=example,dc=com"
|
124
|
+
$ export PYWEBEXEC_LDAP_BIND_PASSWORD="password"
|
125
|
+
$ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,ou=scientists"
|
126
|
+
$ export PYWEBEXEC_LDAP_USER_ID="uid"
|
127
|
+
$ export PYWEBEXEC_LDAP_BASE_DN="dc=example,dc=com"
|
128
|
+
$ pywebexec
|
129
|
+
```
|
130
|
+
## HTTPS server
|
131
|
+
|
132
|
+
* Generate auto-signed certificate and start https server
|
133
|
+
```shell
|
134
|
+
$ pywebexec --gencert
|
135
|
+
$ pywebexec --g
|
136
|
+
```
|
137
|
+
|
138
|
+
* Start https server using existing certificate
|
139
|
+
```shell
|
140
|
+
$ pywebexec --cert /pathto/host.cert --key /pathto/host.key
|
141
|
+
$ pywebexec -c /pathto/host.cert -k /pathto/host.key
|
142
|
+
```
|
143
|
+
|
144
|
+
## Launch server as a daemon
|
145
|
+
|
146
|
+
```shell
|
147
|
+
$ pywebexec start
|
148
|
+
$ pywebexec status
|
149
|
+
$ pywebexec stop
|
150
|
+
```
|
151
|
+
* log of server are stored in directory `~/[.config/].pywebexec/pywebexec_<listen>:<port>.log`
|
152
|
+
|
153
|
+
## Launch command through API
|
154
|
+
|
155
|
+
```shell
|
156
|
+
$ curl http://myhost:8080/run_command -H 'Content-Type: application/json' -X POST -d '{ "command":"myscript", "params":["param1", ...]}'
|
157
|
+
$ curl http://myhost:8080/command_status/<command_id>
|
158
|
+
$ curl http://myhost:8080/command_output/<command_id> -H "Accept: text/plain"
|
159
|
+
```
|
160
|
+
|
161
|
+
## API reference
|
162
|
+
|
163
|
+
|
164
|
+
| method | route | params/payload | returns
|
165
|
+
|-----------|-----------------------------|--------------------|---------------------|
|
166
|
+
| POST | /run_command | command: str<br>params: array[str] | command_id: uuid<br>message: str |
|
167
|
+
| POST | /stop_command/command_id | | message: str |
|
168
|
+
| GET | /command_status/command_id | | command_id: uuid<br>command: str<br>params: array[str]<br>start_time: isotime<br>end_time: isotime<br>status: str<br>exit_code: int<br>last_output_line: str |
|
169
|
+
| GET | /command_output/command_id | offset: int | output: str<br>status: str<br>links: { next: str } |
|
170
|
+
| GET | /commands | | array of<br>command_id: uuid<br>command: str<br>start_time: isotime<br>end_time: isotime<br>status: str<br>exit_code: int<br>last_output_line: str |
|
171
|
+
| GET | /executables | | array of str |
|
@@ -0,0 +1,109 @@
|
|
1
|
+
[![Pypi version](https://img.shields.io/pypi/v/pywebexec.svg)](https://pypi.org/project/pywebexec/)
|
2
|
+
![example](https://github.com/joknarf/pywebexec/actions/workflows/python-publish.yml/badge.svg)
|
3
|
+
[![Licence](https://img.shields.io/badge/licence-MIT-blue.svg)](https://shields.io/)
|
4
|
+
[![PyPI Downloads](https://static.pepy.tech/badge/pywebexec)](https://pepy.tech/projects/pywebexec)
|
5
|
+
[![Python versions](https://img.shields.io/badge/python-3.6+-blue.svg)](https://shields.io/)
|
6
|
+
|
7
|
+
# pywebexec
|
8
|
+
Simple Python HTTP(S) API/Web Command Launcher
|
9
|
+
|
10
|
+
## Install
|
11
|
+
```
|
12
|
+
$ pip install pywebexec
|
13
|
+
```
|
14
|
+
|
15
|
+
## Quick start
|
16
|
+
|
17
|
+
* put in a directory the scripts/commands/links to commands you want to expose
|
18
|
+
* start http server serving current directory executables listening on 0.0.0.0 port 8080
|
19
|
+
```shell
|
20
|
+
$ pywebexec
|
21
|
+
```
|
22
|
+
|
23
|
+
* Launch commands with params/view live output/Status using browser
|
24
|
+
![pywebexecnew4](https://github.com/user-attachments/assets/55e9058c-d2d9-470e-b3ea-60b10dfc7fce)
|
25
|
+
|
26
|
+
all commands output / statuses are available in the executables directory in subdirectory `.web_status`
|
27
|
+
|
28
|
+
## features
|
29
|
+
|
30
|
+
* Serve executables in a directory
|
31
|
+
* Launch commands with params from web browser or API call
|
32
|
+
* Follow live output
|
33
|
+
* Stop command
|
34
|
+
* Relaunch command
|
35
|
+
* HTTPS support
|
36
|
+
* HTTPS self-signed certificate generator
|
37
|
+
* Basic Auth
|
38
|
+
* LDAP(S)
|
39
|
+
* Can be started as a daemon (POSIX)
|
40
|
+
* Uses gunicorn to serve http/https
|
41
|
+
* Linux/MacOS compatible
|
42
|
+
|
43
|
+
## Customize server
|
44
|
+
```shell
|
45
|
+
$ pywebexec --dir ~/myscripts --listen 0.0.0.0 --port 8080 --title myscripts
|
46
|
+
$ pywebexec -d ~/myscripts -l 0.0.0.0 -p 8080 -t myscripts
|
47
|
+
```
|
48
|
+
|
49
|
+
## Basic auth
|
50
|
+
|
51
|
+
* single user/password
|
52
|
+
```shell
|
53
|
+
$ pywebexec --user myuser [--password mypass]
|
54
|
+
$ pywebexec -u myuser [-P mypass]
|
55
|
+
```
|
56
|
+
Generated password is given if no `--pasword` option
|
57
|
+
|
58
|
+
* ldap(s) password check / group member
|
59
|
+
```shell
|
60
|
+
$ export PYWEBEXEC_LDAP_SERVER=ldap://ldap.forumsys.com:389
|
61
|
+
$ export PYWEBEXEC_LDAP_BIND_DN="cn=read-only-admin,dc=example,dc=com"
|
62
|
+
$ export PYWEBEXEC_LDAP_BIND_PASSWORD="password"
|
63
|
+
$ export PYWEBEXEC_LDAP_GROUPS="ou=mathematicians,ou=scientists"
|
64
|
+
$ export PYWEBEXEC_LDAP_USER_ID="uid"
|
65
|
+
$ export PYWEBEXEC_LDAP_BASE_DN="dc=example,dc=com"
|
66
|
+
$ pywebexec
|
67
|
+
```
|
68
|
+
## HTTPS server
|
69
|
+
|
70
|
+
* Generate auto-signed certificate and start https server
|
71
|
+
```shell
|
72
|
+
$ pywebexec --gencert
|
73
|
+
$ pywebexec --g
|
74
|
+
```
|
75
|
+
|
76
|
+
* Start https server using existing certificate
|
77
|
+
```shell
|
78
|
+
$ pywebexec --cert /pathto/host.cert --key /pathto/host.key
|
79
|
+
$ pywebexec -c /pathto/host.cert -k /pathto/host.key
|
80
|
+
```
|
81
|
+
|
82
|
+
## Launch server as a daemon
|
83
|
+
|
84
|
+
```shell
|
85
|
+
$ pywebexec start
|
86
|
+
$ pywebexec status
|
87
|
+
$ pywebexec stop
|
88
|
+
```
|
89
|
+
* log of server are stored in directory `~/[.config/].pywebexec/pywebexec_<listen>:<port>.log`
|
90
|
+
|
91
|
+
## Launch command through API
|
92
|
+
|
93
|
+
```shell
|
94
|
+
$ curl http://myhost:8080/run_command -H 'Content-Type: application/json' -X POST -d '{ "command":"myscript", "params":["param1", ...]}'
|
95
|
+
$ curl http://myhost:8080/command_status/<command_id>
|
96
|
+
$ curl http://myhost:8080/command_output/<command_id> -H "Accept: text/plain"
|
97
|
+
```
|
98
|
+
|
99
|
+
## API reference
|
100
|
+
|
101
|
+
|
102
|
+
| method | route | params/payload | returns
|
103
|
+
|-----------|-----------------------------|--------------------|---------------------|
|
104
|
+
| POST | /run_command | command: str<br>params: array[str] | command_id: uuid<br>message: str |
|
105
|
+
| POST | /stop_command/command_id | | message: str |
|
106
|
+
| GET | /command_status/command_id | | command_id: uuid<br>command: str<br>params: array[str]<br>start_time: isotime<br>end_time: isotime<br>status: str<br>exit_code: int<br>last_output_line: str |
|
107
|
+
| GET | /command_output/command_id | offset: int | output: str<br>status: str<br>links: { next: str } |
|
108
|
+
| GET | /commands | | array of<br>command_id: uuid<br>command: str<br>start_time: isotime<br>end_time: isotime<br>status: str<br>exit_code: int<br>last_output_line: str |
|
109
|
+
| GET | /executables | | array of str |
|
@@ -0,0 +1,59 @@
|
|
1
|
+
[project]
|
2
|
+
name = "pywebexec"
|
3
|
+
authors = [
|
4
|
+
{ name = "Franck Jouvanceau" },
|
5
|
+
]
|
6
|
+
maintainers = [
|
7
|
+
{ name = "Franck Jouvanceau" },
|
8
|
+
]
|
9
|
+
|
10
|
+
description = "Simple Python HTTP Exec Server"
|
11
|
+
dependencies = [
|
12
|
+
"python-daemon>=2.3.2",
|
13
|
+
"cryptography>=40.0.2",
|
14
|
+
"Flask>=2.0.3",
|
15
|
+
"Flask-HTTPAuth>=4.8.0",
|
16
|
+
"gunicorn>=21.2.0",
|
17
|
+
"ldap3>=2.9.1",
|
18
|
+
]
|
19
|
+
dynamic=["version"]
|
20
|
+
readme = "README.md"
|
21
|
+
license = {file = "LICENSE"}
|
22
|
+
requires-python = ">= 3.6"
|
23
|
+
keywords = ["http", "server", "remote commands", "api", "website"]
|
24
|
+
classifiers = [
|
25
|
+
"Development Status :: 5 - Production/Stable",
|
26
|
+
"Intended Audience :: System Administrators",
|
27
|
+
"License :: OSI Approved :: MIT License",
|
28
|
+
"Operating System :: POSIX",
|
29
|
+
"Operating System :: Unix",
|
30
|
+
"Operating System :: Microsoft :: Windows ",
|
31
|
+
"Operating System :: MacOS",
|
32
|
+
"Programming Language :: Python",
|
33
|
+
"Programming Language :: Python :: 3",
|
34
|
+
"Programming Language :: Python :: 3.6",
|
35
|
+
"Programming Language :: Python :: 3.7",
|
36
|
+
"Programming Language :: Python :: 3.8",
|
37
|
+
"Programming Language :: Python :: 3.9",
|
38
|
+
"Programming Language :: Python :: 3.10",
|
39
|
+
"Programming Language :: Python :: 3.11",
|
40
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
41
|
+
"Topic :: System :: Clustering",
|
42
|
+
"Topic :: System :: Networking",
|
43
|
+
"Topic :: System :: Systems Administration",
|
44
|
+
]
|
45
|
+
|
46
|
+
[project.urls]
|
47
|
+
Homepage = "https://github.com/joknarf/pywebexec"
|
48
|
+
Documentation = "https://github.com/joknarf/pywebexec/blob/main/README.md"
|
49
|
+
Repository = "https://github.com/joknarf/pywebexec.git"
|
50
|
+
|
51
|
+
[build-system]
|
52
|
+
requires = ["setuptools >= 61.0", "setuptools_scm[toml]>=6.2"]
|
53
|
+
build-backend = "setuptools.build_meta"
|
54
|
+
|
55
|
+
[tool.setuptools_scm]
|
56
|
+
version_file = "pywebexec/version.py"
|
57
|
+
|
58
|
+
[project.scripts]
|
59
|
+
pywebexec = "pywebexec.pywebexec:main"
|