Skip to content

Commit 7f0f8e8

Browse files
Merge pull request #10 from mauricelambert/dev-3.0.0b
WebScripts 3.0.0
2 parents e3cb7c8 + e969dc4 commit 7f0f8e8

File tree

111 files changed

+11272
-3144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+11272
-3144
lines changed

.github/workflows/unittest.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
name: WebScripts Tests
2-
on:
3-
push:
4-
branches:
5-
- main
6-
- master
7-
pull_request:
8-
branches:
9-
- main
10-
- master
2+
on: [push]
113

124
jobs:
135
build:
146

157
strategy:
168
matrix:
17-
python-version: [3.9, "3.10"]
9+
python-version: [3.9, "3.10", "3.11.0-beta.3"]
1810
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
1911

2012
name: "Run test on ${{ matrix.os }} with ${{ matrix.python-version }}"
@@ -29,6 +21,8 @@ jobs:
2921
- name: Test WebScripts with unittest
3022
run: |
3123
python -m unittest discover -s test -p Test*.py -v
24+
python -c "import json as j,os;f=os.path.join('WebScripts','config','server.json');d=j.load(open(f));d['server']['force_file_permissions']=False;j.dump(d,open(f,'w'))"
25+
python -c "import os;f=os.path.join('WebScripts','WebScripts.py');d=open(f).read().replace('force_file_permissions = True','force_file_permissions=False');open(f,'w').write(d)"
3226
python -m WebScripts --test-running
3327
python -m pip install .
3428
python -m pip install --force-reinstall --install-option "-pabc" --install-option "-d." .

.github/workflows/unittest38.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
name: WebScripts38 Tests
2-
on:
3-
push:
4-
branches:
5-
- main
6-
- master
7-
pull_request:
8-
branches:
9-
- main
10-
- master
2+
on: [push]
113

124
jobs:
135
build:
@@ -30,6 +22,8 @@ jobs:
3022
python WebScripts/scripts/to_3.8/to_3.8.py
3123
python -c "from os import replace;from shutil import rmtree,copytree;rmtree('WebScripts');copytree('WebScripts38', 'WebScripts');replace('setup38.py', 'setup.py')"
3224
python -m unittest discover -s test -p Test*.py -v
25+
python -c "import json as j,os;f=os.path.join('WebScripts','config','server.json');d=j.load(open(f));d['server']['force_file_permissions']=False;j.dump(d,open(f,'w'))"
26+
python -c "import os;f=os.path.join('WebScripts','WebScripts.py');d=open(f).read().replace('force_file_permissions = True','force_file_permissions=False');open(f,'w').write(d)"
3327
python -m WebScripts --test-running
3428
python -m pip install .
3529
python -m pip install --force-reinstall --install-option "-pabc" --install-option "-d." .

PKG-INFO

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: WebScripts
3-
Version: 2.5.14
3+
Version: 3.0.0
44
Summary: This tool run scripts and display the result in a Web Interface.
55
Home-page: https://github.com/mauricelambert/WebScripts
66
Author: Maurice Lambert
@@ -74,7 +74,18 @@ Create a safe, secure and easy way to share CLI (console) scripts and scripting
7474
- [docker with Nginx as HTTPS proxy HTML report](https://mauricelambert.github.io/info/python/code/WebScripts/docker_nginx_audit.html),
7575
- [docker HTML report](https://mauricelambert.github.io/info/python/code/WebScripts/docker_audit.html)
7676
- [File integrity checks](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#file-integrity)([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#file-integrity)), the WebScripts server implements a daemon thread to check file integrity hourly.
77-
- Centralization of logs (using Syslog on Linux and Event Viewer on Windows)
77+
- Logs
78+
- Centralization (using Syslog on Linux and Event Viewer on Windows)
79+
- Levels
80+
- Trace (5) [Specific file]
81+
- Debug (10) [Specific file, full logs file, console, centralization]
82+
- Info (20) [Specific file, full logs file, console, centralization]
83+
- Request (26) [Specific file, full logs file, console, centralization]
84+
- Response (27) [Specific file, full logs file, console, centralization]
85+
- Command (28) [Specific file, full logs file, console, centralization]
86+
- Warning (30) [Specific file, full logs file, console, centralization]
87+
- Error (40) [Specific file, full logs file, console, centralization]
88+
- Critical (50) [Specific file, full logs file, console, centralization]
7889
- Easy to update and patch security issues on Linux (critical functions are implemented in Standard Library and are updated with your system) (WebScripts does not require any python package)
7990
- Easy to deploy securely
8091
- [Docker with Apache and mod_wsgi](https://hub.docker.com/r/mauricelambert/webscripts) ([github](https://github.com/mauricelambert/WebScriptsContainers))
@@ -85,10 +96,10 @@ Create a safe, secure and easy way to share CLI (console) scripts and scripting
8596
- Easy to configure securely [(read the documentation)](https://webscripts.readthedocs.io/en/latest/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/))
8697
- INI/CFG syntax
8798
- JSON syntax
88-
- [Unittest](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#unittest) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#unittest))
89-
- ubuntu && python [3.8, 3.9, 3.10]
90-
- windows && python [3.8, 3.9, 3.10]
91-
- MacOS && python [3.8, 3.9, 3.10]
99+
- [Unittest - 99% Code Coverage (2104/2108 lines)](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#unittest) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#unittest))
100+
- ubuntu && python [3.8, 3.9, 3.10, 3.11]
101+
- windows && python [3.8, 3.9, 3.10, 3.11]
102+
- MacOS && python [3.8, 3.9, 3.10, 3.11]
92103
- Customizable
93104
- [Authentication](https://webscripts.readthedocs.io/en/latest/Authentication/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Authentication)) - [example](https://webscripts.readthedocs.io/en/latest/Add_Script/#build-the-script) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Add-Script#build-the-script))
94105
- Web Interface: HTML, CSS and JS [files](https://webscripts.readthedocs.io/en/latest/WEB_Interface/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/WEB-Interface))
@@ -288,5 +299,3 @@ WebScripts38.main()
288299
## License
289300

290301
Licensed under the [GPL, version 3](https://www.gnu.org/licenses/).
291-
292-

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@ Create a safe, secure and easy way to share CLI (console) scripts and scripting
3737
- [docker with Nginx as HTTPS proxy HTML report](https://mauricelambert.github.io/info/python/code/WebScripts/docker_nginx_audit.html),
3838
- [docker HTML report](https://mauricelambert.github.io/info/python/code/WebScripts/docker_audit.html)
3939
- [File integrity checks](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#file-integrity)([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#file-integrity)), the WebScripts server implements a daemon thread to check file integrity hourly.
40-
- Centralization of logs (using Syslog on Linux and Event Viewer on Windows)
40+
- Logs
41+
- Centralization (using Syslog on Linux and Event Viewer on Windows)
42+
- Levels
43+
- Trace (5) [Specific file]
44+
- Debug (10) [Specific file, full logs file, console, centralization]
45+
- Info (20) [Specific file, full logs file, console, centralization]
46+
- Request (26) [Specific file, full logs file, console, centralization]
47+
- Response (27) [Specific file, full logs file, console, centralization]
48+
- Command (28) [Specific file, full logs file, console, centralization]
49+
- Warning (30) [Specific file, full logs file, console, centralization]
50+
- Error (40) [Specific file, full logs file, console, centralization]
51+
- Critical (50) [Specific file, full logs file, console, centralization]
4152
- Easy to update and patch security issues on Linux (critical functions are implemented in Standard Library and are updated with your system) (WebScripts does not require any python package)
4253
- Easy to deploy securely
4354
- [Docker with Apache and mod_wsgi](https://hub.docker.com/r/mauricelambert/webscripts) ([github](https://github.com/mauricelambert/WebScriptsContainers))
@@ -48,10 +59,10 @@ Create a safe, secure and easy way to share CLI (console) scripts and scripting
4859
- Easy to configure securely [(read the documentation)](https://webscripts.readthedocs.io/en/latest/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/))
4960
- INI/CFG syntax
5061
- JSON syntax
51-
- [Unittest](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#unittest) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#unittest))
52-
- ubuntu && python [3.8, 3.9, 3.10]
53-
- windows && python [3.8, 3.9, 3.10]
54-
- MacOS && python [3.8, 3.9, 3.10]
62+
- [Unittest - 99% Code Coverage (2104/2108 lines)](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#unittest) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#unittest))
63+
- ubuntu && python [3.8, 3.9, 3.10, 3.11]
64+
- windows && python [3.8, 3.9, 3.10, 3.11]
65+
- MacOS && python [3.8, 3.9, 3.10, 3.11]
5566
- Customizable
5667
- [Authentication](https://webscripts.readthedocs.io/en/latest/Authentication/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Authentication)) - [example](https://webscripts.readthedocs.io/en/latest/Add_Script/#build-the-script) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Add-Script#build-the-script))
5768
- Web Interface: HTML, CSS and JS [files](https://webscripts.readthedocs.io/en/latest/WEB_Interface/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/WEB-Interface))

Scripts/activate_this.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1818
site_packages = os.path.join(
19-
base, "lib", "python%s" % sys.version[:3], "site-packages"
19+
base, "lib", "python%s" % ".".join(sys.version.split(".", 2)[:2]), "site-packages"
2020
)
2121
prev_sys_path = list(sys.path)
2222
import site

Scripts/wsgi.py

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
from collections.abc import Callable
5-
from os import chdir, name, environ
64
from os.path import join, dirname
75
from typing import List
86
import atexit
97

10-
chdir(join(dirname(__file__), ".."))
8+
activator = join(dirname(__file__), "activate_this.py")
119

12-
activator = (
13-
r"Scripts\activate_this.py" if name == "nt" else "bin/activate_this.py"
14-
)
1510
with open(activator) as f:
1611
exec(f.read(), {"__file__": activator}) # nosec # nosemgrep
1712

1813
from WebScripts.WebScripts import (
19-
Configuration,
20-
get_server_config,
21-
add_configuration,
22-
logs_configuration,
23-
server_path,
2414
Server,
2515
configure_logs_system,
2616
send_mail,
27-
get_real_path,
2817
hardening,
2918
Logs,
19+
logger_debug,
20+
logger_info,
21+
logger_warning,
22+
default_configuration,
3023
)
3124

3225

@@ -42,26 +35,10 @@ def __init__(self, config_cfg: List[str], config_json: List[str]):
4235

4336

4437
configure_logs_system()
45-
environ["SERVER_LOG_PATH"] = get_real_path("logs", is_dir=True)
46-
environ["WEBSCRIPTS_PATH"] = server_path
4738

48-
logger_debug: Callable = Logs.debug
49-
logger_info: Callable = Logs.info
50-
logger_warning: Callable = Logs.warning
5139
paths = Paths([], [])
5240

53-
logger_debug("Load configurations...")
54-
configuration = Configuration()
55-
for config in get_server_config(paths):
56-
configuration = add_configuration(configuration, config)
57-
58-
logs_configuration(configuration)
59-
60-
logger_debug("Check and type configurations...")
61-
configuration.set_defaults()
62-
configuration.check_required()
63-
configuration.get_unexpecteds()
64-
configuration.build_types()
41+
configuration = default_configuration()
6542

6643
logger_debug("Build server with configurations...")
6744
server = Server(configuration)
@@ -79,7 +56,7 @@ def __init__(self, config_cfg: List[str], config_json: List[str]):
7956
)
8057

8158
logger_info("Check hardening of the WebScripts server...")
82-
hardening(server, Logs, send_mail)
59+
hardening(server)
8360

8461
logger_warning("Starting server...")
8562
application = server.app

WebScripts.egg-info/PKG-INFO

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: WebScripts
3-
Version: 2.5.14
3+
Version: 3.0.0
44
Summary: This tool run scripts and display the result in a Web Interface.
55
Home-page: https://github.com/mauricelambert/WebScripts
66
Author: Maurice Lambert
@@ -74,7 +74,18 @@ Create a safe, secure and easy way to share CLI (console) scripts and scripting
7474
- [docker with Nginx as HTTPS proxy HTML report](https://mauricelambert.github.io/info/python/code/WebScripts/docker_nginx_audit.html),
7575
- [docker HTML report](https://mauricelambert.github.io/info/python/code/WebScripts/docker_audit.html)
7676
- [File integrity checks](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#file-integrity)([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#file-integrity)), the WebScripts server implements a daemon thread to check file integrity hourly.
77-
- Centralization of logs (using Syslog on Linux and Event Viewer on Windows)
77+
- Logs
78+
- Centralization (using Syslog on Linux and Event Viewer on Windows)
79+
- Levels
80+
- Trace (5) [Specific file]
81+
- Debug (10) [Specific file, full logs file, console, centralization]
82+
- Info (20) [Specific file, full logs file, console, centralization]
83+
- Request (26) [Specific file, full logs file, console, centralization]
84+
- Response (27) [Specific file, full logs file, console, centralization]
85+
- Command (28) [Specific file, full logs file, console, centralization]
86+
- Warning (30) [Specific file, full logs file, console, centralization]
87+
- Error (40) [Specific file, full logs file, console, centralization]
88+
- Critical (50) [Specific file, full logs file, console, centralization]
7889
- Easy to update and patch security issues on Linux (critical functions are implemented in Standard Library and are updated with your system) (WebScripts does not require any python package)
7990
- Easy to deploy securely
8091
- [Docker with Apache and mod_wsgi](https://hub.docker.com/r/mauricelambert/webscripts) ([github](https://github.com/mauricelambert/WebScriptsContainers))
@@ -85,10 +96,10 @@ Create a safe, secure and easy way to share CLI (console) scripts and scripting
8596
- Easy to configure securely [(read the documentation)](https://webscripts.readthedocs.io/en/latest/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/))
8697
- INI/CFG syntax
8798
- JSON syntax
88-
- [Unittest](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#unittest) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#unittest))
89-
- ubuntu && python [3.8, 3.9, 3.10]
90-
- windows && python [3.8, 3.9, 3.10]
91-
- MacOS && python [3.8, 3.9, 3.10]
99+
- [Unittest - 99% Code Coverage (2104/2108 lines)](https://webscripts.readthedocs.io/en/latest/Development_and_Administration_Tools/#unittest) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Development-and-Administration-Tools#unittest))
100+
- ubuntu && python [3.8, 3.9, 3.10, 3.11]
101+
- windows && python [3.8, 3.9, 3.10, 3.11]
102+
- MacOS && python [3.8, 3.9, 3.10, 3.11]
92103
- Customizable
93104
- [Authentication](https://webscripts.readthedocs.io/en/latest/Authentication/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Authentication)) - [example](https://webscripts.readthedocs.io/en/latest/Add_Script/#build-the-script) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/Add-Script#build-the-script))
94105
- Web Interface: HTML, CSS and JS [files](https://webscripts.readthedocs.io/en/latest/WEB_Interface/) ([wiki](https://github.com/mauricelambert/WebScripts/wiki/WEB-Interface))
@@ -288,5 +299,3 @@ WebScripts38.main()
288299
## License
289300

290301
Licensed under the [GPL, version 3](https://www.gnu.org/licenses/).
291-
292-

0 commit comments

Comments
 (0)