pywebexec 1.2.4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pywebexec/__init__.py +5 -0
- pywebexec/pywebexec.py +595 -0
- pywebexec/static/css/style.css +178 -0
- pywebexec/static/css/xterm.css +209 -0
- pywebexec/static/images/aborted.svg +1 -0
- pywebexec/static/images/copy.svg +1 -0
- pywebexec/static/images/copy_ok.svg +1 -0
- pywebexec/static/images/failed.svg +1 -0
- pywebexec/static/images/favicon.svg +1 -0
- pywebexec/static/images/running.gif +0 -0
- pywebexec/static/images/success.svg +1 -0
- pywebexec/static/js/script.js +280 -0
- pywebexec/static/js/xterm/LICENSE +21 -0
- pywebexec/static/js/xterm/ansi_up.min.js +7 -0
- pywebexec/static/js/xterm/xterm-addon-fit.js +1 -0
- pywebexec/static/js/xterm/xterm.js +1 -0
- pywebexec/templates/__init__.py +0 -0
- pywebexec/templates/index.html +48 -0
- pywebexec/version.py +16 -0
- pywebexec-1.2.4.dist-info/LICENSE +21 -0
- pywebexec-1.2.4.dist-info/METADATA +171 -0
- pywebexec-1.2.4.dist-info/RECORD +25 -0
- pywebexec-1.2.4.dist-info/WHEEL +5 -0
- pywebexec-1.2.4.dist-info/entry_points.txt +2 -0
- pywebexec-1.2.4.dist-info/top_level.txt +1 -0
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<link rel="icon" href="/static/images/favicon.svg" type="image/svg+xml">
|
6
|
+
<title>{{ title }}</title>
|
7
|
+
<link rel="stylesheet" href="/static/css/style.css">
|
8
|
+
<link rel="stylesheet" href="/static/css/xterm.css">
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="dimmer" class="dimmer">
|
12
|
+
<div class="dimmer-text">Server not reachable</div>
|
13
|
+
</div>
|
14
|
+
<h2><span class="status-icon title-icon"></span>{{ title }}</h2>
|
15
|
+
<form id="launchForm">
|
16
|
+
<label for="commandName">Command</label>
|
17
|
+
<select id="commandName" name="commandName"></select>
|
18
|
+
<label for="params">Params</label>
|
19
|
+
<input type="text" id="params" name="params">
|
20
|
+
<button type="submit">Run</button>
|
21
|
+
</form>
|
22
|
+
<div class="table-container" id="tableContainer">
|
23
|
+
<table>
|
24
|
+
<thead>
|
25
|
+
<tr>
|
26
|
+
<th>ID</th>
|
27
|
+
<th>Start Time</th>
|
28
|
+
<th>Duration</th>
|
29
|
+
<th>Command</th>
|
30
|
+
<th>Exit</th>
|
31
|
+
<th>Status</th>
|
32
|
+
<th>Action</th>
|
33
|
+
<th>Output</th>
|
34
|
+
</tr>
|
35
|
+
</thead>
|
36
|
+
<tbody id="commands"></tbody>
|
37
|
+
</table>
|
38
|
+
</div>
|
39
|
+
<div class="resizer-container">
|
40
|
+
<div class="resizer" id="resizer"></div>
|
41
|
+
</div>
|
42
|
+
<div id="output" class="output"></div>
|
43
|
+
<script src="/static/js/xterm/ansi_up.min.js"></script>
|
44
|
+
<script src="/static/js/xterm/xterm.js"></script>
|
45
|
+
<script src="/static/js/xterm/xterm-addon-fit.js"></script>
|
46
|
+
<script type="text/javascript" src="/static/js/script.js"></script>
|
47
|
+
</body>
|
48
|
+
</html>
|
pywebexec/version.py
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# file generated by setuptools_scm
|
2
|
+
# don't change, don't track in version control
|
3
|
+
TYPE_CHECKING = False
|
4
|
+
if TYPE_CHECKING:
|
5
|
+
from typing import Tuple, Union
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
7
|
+
else:
|
8
|
+
VERSION_TUPLE = object
|
9
|
+
|
10
|
+
version: str
|
11
|
+
__version__: str
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
13
|
+
version_tuple: VERSION_TUPLE
|
14
|
+
|
15
|
+
__version__ = version = '1.2.4'
|
16
|
+
__version_tuple__ = version_tuple = (1, 2, 4)
|
@@ -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.
|
@@ -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,25 @@
|
|
1
|
+
pywebexec/__init__.py,sha256=4spIsVaF8RJt8S58AG_wWoORRNkws9Iwqprj27C3ljM,99
|
2
|
+
pywebexec/pywebexec.py,sha256=fEa7BPsra8ALJSPHj9z4Keyfv4r_zUBqE2hTmH4Njmk,22657
|
3
|
+
pywebexec/version.py,sha256=DFpsAdSrahcTSWRccxC8nEJpgcmby0LdmRoAddZy2zA,411
|
4
|
+
pywebexec/static/css/style.css,sha256=nvZ6RJ-0PGYDzA2ZnNN__C1oONYkEao_XkNgdRXQ1lM,3607
|
5
|
+
pywebexec/static/css/xterm.css,sha256=gy8_LGA7Q61DUf8ElwFQzHqHMBQnbbEmpgZcbdgeSHI,5383
|
6
|
+
pywebexec/static/images/aborted.svg,sha256=_mP43hU5QdRLFZIknBgjx-dIXrHgQG23-QV27ApXK2A,381
|
7
|
+
pywebexec/static/images/copy.svg,sha256=d9OwtGh5GzzZHzYcDrLfNxZYLth1Q64x7bRyYxu4Px0,622
|
8
|
+
pywebexec/static/images/copy_ok.svg,sha256=mEqUVUhSq8xaJK2msQkxRawnz_KwlCZ-tok8QS6hJ3g,451
|
9
|
+
pywebexec/static/images/failed.svg,sha256=ADZ7IKrUyOXtqpivnz3VcH0-Wru-I5MOi3OJAkI3hxk,1439
|
10
|
+
pywebexec/static/images/favicon.svg,sha256=ti80IfuDZwIvQcmJxkOeUaB1iMsiyOPmQmVO-h0y1IU,1126
|
11
|
+
pywebexec/static/images/running.gif,sha256=iYuzQGkMxrakSIwt6gPieKCImGZoSAHmU5MUNZa7cpw,25696
|
12
|
+
pywebexec/static/images/success.svg,sha256=PJDcCSTevJh7rkfSFLtc7P0pbeh8PVQBS8DaOLQemmc,489
|
13
|
+
pywebexec/static/js/script.js,sha256=zdvM_4BxNr4hfsJ6B2PZJshtI8kErVgQEeaaSO8QlTA,9962
|
14
|
+
pywebexec/static/js/xterm/LICENSE,sha256=EU1P4eXTull-_T9I80VuwnJXubB-zLzUl3xpEYj2T1M,1083
|
15
|
+
pywebexec/static/js/xterm/ansi_up.min.js,sha256=KNGV0vEr30hNqKQimTAvGVy-icD5A1JqMQTtvYtKR2Y,13203
|
16
|
+
pywebexec/static/js/xterm/xterm-addon-fit.js,sha256=Pprm9pZe4SadVXS5Bc8b9VnC9Ex4QlWwA0pxOH53Gck,1460
|
17
|
+
pywebexec/static/js/xterm/xterm.js,sha256=Bzka76jZwEhVt_LlS0e0qMw7ryGa1p5qfxFyeohphBo,283371
|
18
|
+
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
+
pywebexec/templates/index.html,sha256=8dGO5qKZsAjbmsnrSbhrPN2I2_Jaxle7F3GTOcfkaLM,1689
|
20
|
+
pywebexec-1.2.4.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
21
|
+
pywebexec-1.2.4.dist-info/METADATA,sha256=gJn5WOV_Fgcxu2ax9krThpXbPDVv0LV1WfhWlvg1D0Y,6936
|
22
|
+
pywebexec-1.2.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
23
|
+
pywebexec-1.2.4.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
24
|
+
pywebexec-1.2.4.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
25
|
+
pywebexec-1.2.4.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
pywebexec
|