Skip to content

Commit

Permalink
Merge pull request #20 from mauricelambert/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mauricelambert authored Jun 27, 2024
2 parents dd54989 + 02fd4bd commit f774433
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: WebScripts
Version: 3.0.36
Version: 3.0.38
Summary: This tool runs CLI scripts and displays output in a Web Interface.
Home-page: https://github.com/mauricelambert/WebScripts
Author: Maurice Lambert
Expand Down
2 changes: 1 addition & 1 deletion WebScripts.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: WebScripts
Version: 3.0.36
Version: 3.0.38
Summary: This tool runs CLI scripts and displays output in a Web Interface.
Home-page: https://github.com/mauricelambert/WebScripts
Author: Maurice Lambert
Expand Down
2 changes: 1 addition & 1 deletion WebScripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
This tool runs CLI scripts and displays output in a Web Interface.
"""

__version__ = "3.0.36"
__version__ = "3.0.38"
__author__ = "Maurice Lambert"
__author_email__ = "mauricelambert434@gmail.com"
__maintainer__ = "Maurice Lambert"
Expand Down
2 changes: 1 addition & 1 deletion WebScripts/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
This tool runs CLI scripts and displays output in a Web Interface.
"""

__version__ = "3.0.36"
__version__ = "3.0.38"
__author__ = "Maurice Lambert"
__author_email__ = "mauricelambert434@gmail.com"
__maintainer__ = "Maurice Lambert"
Expand Down
20 changes: 16 additions & 4 deletions WebScripts/harden.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

###################
# This tool runs CLI scripts and displays output in a Web Interface.
# Copyright (C) 2021, 2022, 2023 Maurice Lambert
# Copyright (C) 2021, 2022, 2023, 2024 Maurice Lambert

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -25,7 +25,7 @@
This file hardens the WebScripts installation and configuration.
"""

__version__ = "0.0.8"
__version__ = "0.0.9"
__author__ = "Maurice Lambert"
__author_email__ = "mauricelambert434@gmail.com"
__maintainer__ = "Maurice Lambert"
Expand All @@ -39,7 +39,7 @@
__url__ = "https://github.com/mauricelambert/WebScripts"

copyright = """
WebScripts Copyright (C) 2021, 2022, 2023 Maurice Lambert
WebScripts Copyright (C) 2021, 2022, 2023, 2024 Maurice Lambert
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
Expand Down Expand Up @@ -71,6 +71,7 @@
abspath,
basename,
exists,
normpath,
)
from importlib.util import spec_from_loader, module_from_spec
from logging import FileHandler, Formatter, getLogger, Logger
Expand Down Expand Up @@ -207,6 +208,7 @@ def __init__(
directory: str = None,
):
self.admin_password = admin_password
self.documentation_paths = []
self.json_only = json_only
self.owner = owner or getuser()
self.directory = directory or getcwd()
Expand Down Expand Up @@ -293,7 +295,11 @@ def harden_server(self, section: dict, directory: str) -> None:
if self.is_windows:
path_.insert(1, "..")

section["modules_path"] = abspath(join(*path_, "modules"))
self.documentation_paths = section["documentations_path"] = [
normpath(abspath(join(self.directory, x)))
for x in section["documentations_path"]
]
section["modules_path"] = [normpath(abspath(join(*path_, "modules")))]
section["data_dir"] = abspath(join(self.directory, "data"))
section["json_scripts_config"] = self.get_files_from_glob_path(
path_, section["json_scripts_config"]
Expand Down Expand Up @@ -369,6 +375,12 @@ def linux_hardening_file_permissions(self) -> None:
chmod(logs, 0o700) # nosec
chown(logs, pw_uid, pw_gid)

for documentation_path in self.documentation_paths:
documentation_directory = dirname(documentation_path)
makedirs(documentation_directory, exist_ok=True)
chmod(documentation_directory, 0o700) # nosec
chown(documentation_directory, pw_uid, pw_gid)

def linux_file_permissions(self, filename: str) -> None:
"""
This method changes files permissions on Linux.
Expand Down
2 changes: 1 addition & 1 deletion WebScripts/static/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#9286C2">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>__init__</strong></big></big> (version 3.0.36)</font></td
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>__init__</strong></big></big> (version 3.0.38)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="__init__.py">__init__.py</a></font></td></tr></table>
<p><tt>This&nbsp;tool&nbsp;runs&nbsp;CLI&nbsp;scripts&nbsp;and&nbsp;displays&nbsp;output&nbsp;in&nbsp;a&nbsp;Web&nbsp;Interface.</tt></p>
Expand Down

0 comments on commit f774433

Please sign in to comment.