Python: module hardening

hardening (version 1.1.6) | index hardening.py

`This tool runs CLI scripts and displays output in a Web Interface.
This file implement the hardening audit of the WebScripts installation and
configuration.`

Modules
`` |  |
ctypes | os | pip |

Classes
`` |  | builtins.object Audit Report Rule enum.Enum(builtins.object) SEVERITY
class Audit(builtins.object)
`` | `This function implement hardening checks.`
| Methods defined here: audit_active_auth(server: ~Server) -> hardening.Rule `This function checks authentication is enabled.` audit_admin_account(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the admin password.` audit_blacklist(server: ~Server) -> hardening.Rule `This function checks the blacklist configuration.` audit_config_files(server: ~Server) -> hardening.Rule `This function checks the configurations files.` audit_debug(server: ~Server) -> hardening.Rule `This function checks the debug configuration.` audit_export_configuration(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the export configuration file.` audit_force_auth(server: ~Server) -> hardening.Rule `This function checks authentication is forced.` audit_in_venv(server: ~Server) -> hardening.Rule `This function checks the virtualenv.` audit_interface(server: ~Server) -> hardening.Rule `This function checks the network interface.` audit_limit_exclude_auth(server: ~Server) -> hardening.Rule `This function checks exclusions for authentication.` audit_log_level(server: ~Server) -> hardening.Rule `This function checks the log level.` audit_security(server: ~Server) -> hardening.Rule `This function checks the security configuration.` audit_smtp_password(server: ~Server) -> hardening.Rule `This function checks the SMTP password protection.` audit_system_user(server: ~Server) -> hardening.Rule `This function checks the user.` audit_venv_modules(server: ~Server) -> hardening.Rule `This function checks the virtualenv modules.` audit_webproxy_number(server: ~Server) -> hardening.Rule `This function checks exclusions for authentication.` audits_file_owner(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the files owner.` audits_file_rights(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the files rights.` audits_launcher(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the configuration of the script launcher.` audits_module_path(server: ~Server) -> hardening.Rule `This function checks the modules paths.` audits_scripts_content_type(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the configuration of the script content type.` audits_scripts_logs(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the configuration of the script log.` audits_scripts_path(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the configuration of the script path.` audits_scripts_stderr_content_type(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks the configuration of the script stderr content type.` audits_timeout(server: ~Server) -> collections.abc.Iterator[hardening.Rule] `This function checks scripts timeout.` check_for_updates(logs: ~Logs) -> None `This function runs in a thread indefinitely, it checks the version and the latest published version of WebScripts every hour. If the version and the latest published version are different, this function sends an email notification.` get_owner(filename: str) -> str `This function return the owner of a file.` get_permissions(filename: str) -> str `This function returns the file permissions.` log_rule(rule: hardening.Rule, logs: ~Logs) -> None `This function log rule.` run(server: ~Server) -> List[hardening.Rule] `This function run audit and checks.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: current_dir = r'C:\Program Files\Python310' is_windows = True latest = [] latest_ = [] network_up = True
class Report(builtins.object)
`` | `Report(rules: List[hardening.Rule], file_integrity: List[Dict[str, str]], server: ~Server) This class implement the report object.`
| Methods defined here: __init__(self, rules: List[hardening.Rule], file_integrity: List[Dict[str, str]], server: ~Server) `Initialize self. See help(type(self)) for accurate signature.` as_html(self) -> str `This function return a HTML string of audit results.` as_json(self) -> str `This function returns a JSON string of audit results.` as_text(self) -> str `This function return a HTML string of audit results.` get_pourcent(self) -> None `This function calcul pourcent.` notification(self) -> None `This function send an email notification to administrator with the audit report.` Static methods defined here: get_HTML_table(headers: str, rules: List[hardening.Rule]) -> str `This function returns a HTML table with rule attributes as columns.` get_text_table(headers: str, rules: List[hardening.Rule], joiner: str = ' ') -> str `This function return a text table with rule attributes as columns.` truncate_string(string: str, length: int = 13, end: str = '...', separator: str = ',') -> str `This function truncate a string.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class Rule(builtins.object)
`` | `Rule(subject: str, id_: int, is_OK: bool, level: int, severity: str, category: str, reason: str) -&gt; None This class implement a rule for hardening.`
| Methods defined here: __eq__(self, other) `Return self==value.` __init__(self, subject: str, id_: int, is_OK: bool, level: int, severity: str, category: str, reason: str) -> None `Initialize self. See help(type(self)) for accurate signature.` __repr__(self) `Return repr(self).` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: __annotations__ = {'category': <class 'str'>, 'id_': <class 'int'>, 'is_OK': <class 'bool'>, 'level': <class 'int'>, 'reason': <class 'str'>, 'severity': <class 'str'>, 'subject': <class 'str'>} __dataclass_fields__ = {'category': Field(name='category',type=<class 'str'>,default...appingproxy({}),kw_only=False,_field_type=_FIELD), 'id_': Field(name='id_',type=<class 'int'>,default=<dat...appingproxy({}),kw_only=False,_field_type=_FIELD), 'is_OK': Field(name='is_OK',type=<class 'bool'>,default=<...appingproxy({}),kw_only=False,_field_type=_FIELD), 'level': Field(name='level',type=<class 'int'>,default=<d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'reason': Field(name='reason',type=<class 'str'>,default=<...appingproxy({}),kw_only=False,_field_type=_FIELD), 'severity': Field(name='severity',type=<class 'str'>,default...appingproxy({}),kw_only=False,_field_type=_FIELD), 'subject': Field(name='subject',type=<class 'str'>,default=...appingproxy({}),kw_only=False,_field_type=_FIELD)} __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False) __hash__ = None __match_args__ = ('subject', 'id_', 'is_OK', 'level', 'severity', 'category', 'reason')
class SEVERITY(enum.Enum)
`` | `SEVERITY(value, names=None, *, module=None, qualname=None, type=None, start=1) Severity level of the rules.`
| Method resolution order: SEVERITY enum.Enum builtins.object Data and other attributes defined here: CRITICAL = <SEVERITY.CRITICAL: 'CRITICAL'> HIGH = <SEVERITY.HIGH: 'HIGH'> INFORMATION = <SEVERITY.INFORMATION: 'INFORMATION'> LOW = <SEVERITY.LOW: 'LOW'> MEDIUM = <SEVERITY.MEDIUM: 'MEDIUM'> Data descriptors inherited from enum.Enum: name `The name of the Enum member.` value `The value of the Enum member.` Readonly properties inherited from enum.EnumMeta: __members__ `Returns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping.`

Functions
`` |  | main(server: ~Server) -> hardening.Report `The main function to perform WebScripts Server hardening audit.`

Data
`` |  | __all__ = ['Report', 'Rule', 'Audit', 'SEVERITY', 'main'] __author_email__ = 'mauricelambert434@gmail.com' __copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n' __description__ = '\nThis tool runs CLI scripts and displays output ...f the WebScripts installation and\nconfiguration.\n' __license__ = 'GPL-3.0 License' __maintainer__ = 'Maurice Lambert' __maintainer_email__ = 'mauricelambert434@gmail.com' __url__ = 'https://github.com/mauricelambert/WebScripts'

Author
`` |  | Maurice Lambert