-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add hardening rule for script timeout - change hardening level - re-make hardening python code - hardening report (text) - auto-delete process for real time output - MANIFEST.in exclude audit files - Fix: request multiline - Fix: request first output - Fix: csv databases (NUL characters) - Fix: Windows config files
- Loading branch information
1 parent
147f47b
commit 20d66e7
Showing
21 changed files
with
295 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
system. | ||
""" | ||
|
||
__version__ = "1.0.0" | ||
__version__ = "1.0.1" | ||
__author__ = "Maurice Lambert" | ||
__author_email__ = "[email protected]" | ||
__maintainer__ = "Maurice Lambert" | ||
|
@@ -360,11 +360,14 @@ class Process: | |
This class implements a running processus. | ||
""" | ||
|
||
def __init__(self, process: Popen, script: ScriptConfig, user: User): | ||
def __init__( | ||
self, process: Popen, script: ScriptConfig, user: User, key: str | ||
): | ||
Logs.debug("Process creation...") | ||
self.process = process | ||
self.script = script | ||
self.user = user | ||
self.key = key | ||
self.start_time = time() | ||
self.timeout = script.timeout | ||
|
||
|
@@ -382,6 +385,7 @@ def get_line(self, read: bool = True) -> Tuple[bytes, bytes, str]: | |
|
||
self.process.stdout.flush() | ||
if self.process.poll() == 0: | ||
del Pages.processes[self.key] | ||
return ( | ||
self.process.stdout.read(), | ||
self.process.stderr.read(), | ||
|
@@ -402,7 +406,11 @@ def get_line(self, read: bool = True) -> Tuple[bytes, bytes, str]: | |
if read: | ||
stdout = self.process.stdout.read() | ||
stderr = self.process.stderr.read() | ||
del Pages.processes[self.key] | ||
else: | ||
self.timer = Timer(300, self.get_line) | ||
# delete the process 5 minutes after the timeout | ||
self.timer.start() | ||
stdout = b"" | ||
stderr = b"" | ||
|
||
|
@@ -467,9 +475,6 @@ def get( | |
|
||
stdout, stderr, error = process.get_line() | ||
|
||
if error: | ||
del Pages.processes[filename] | ||
|
||
response_object = { | ||
"stdout": decode_output(stdout) if stdout else "", | ||
"stderr": decode_output(stderr) if stderr else "", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
|
||
"""This tools run scripts and display the result in a Web Interface.""" | ||
|
||
__version__ = "2.4.1" | ||
__version__ = "2.4.2" | ||
__author__ = "Maurice Lambert" | ||
__author_email__ = "[email protected]" | ||
__maintainer__ = "Maurice Lambert" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
|
||
"""This tools run scripts and display the result in a Web Interface.""" | ||
|
||
__version__ = "2.4.1" | ||
__version__ = "2.4.2" | ||
__author__ = "Maurice Lambert" | ||
__author_email__ = "[email protected]" | ||
__maintainer__ = "Maurice Lambert" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"script": { | ||
"timeout": 15, | ||
"launcher": "python3", | ||
"minimum_access": 50, | ||
"category": "My Account", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"script": { | ||
"timeout": 15, | ||
"launcher": "python", | ||
"minimum_access": 50, | ||
"category": "My Account", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ [email protected] | |
auth.py=config_auth # Define the configuration section ("config_auth") for script named "auth.py" | ||
show_license.py=config_show_licence # Same as previous for "show_license.py" with "config_show_licence" | ||
change_my_password.py=config_change_my_password # Same as previous for "change_my_password.py" with "config_change_my_password" | ||
# test_config.py=config_test_config # Little script to test arguments and script configurations | ||
test_config.py=config_test_config # Little script to test arguments and script configurations | ||
|
||
[config_auth] | ||
launcher=python # Define the launcher for this script (if script is executable this line is not necessary) | ||
|
@@ -59,7 +59,7 @@ access_users=0,1,2 | |
args=auth_args # The arguments are defined in section named "auth_args" | ||
description=This script authenticates users. # Short description to help users | ||
category=My Account # Add a link on the index page in the "My Account" section | ||
timeout=10 # Timeout for process execution (in seconds) | ||
timeout=15 # Timeout for process execution (in seconds) | ||
command_generate_documentation=python "%(dirname)s/../doc/py_doc.py" "%(path)s" # Command line to generate the documentation file | ||
|
||
# Script "auth.py" is in "./scripts/account" and this path is defined in "scripts_path" so is not necessary to add the "path" in configuration section | ||
|
@@ -108,9 +108,10 @@ example=password | |
configuration_file=./config/nt/files/change_my_password.json # Define script configuration in a specific file | ||
|
||
[config_test_config] | ||
configuration_file=./config/files/test_config.json | ||
configuration_file=./config/nt/files/test_config.json | ||
|
||
[config_show_licence] | ||
timeout=15 # Timeout for process execution (in seconds) | ||
launcher=python # Define the launcher for this script (if script is executable this line is not necessary) | ||
category=License # Add a link on the index page in the "License" section | ||
no_password=false # Log the execution command line (must be false if a password is in arguments) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.