From: Alexander Popov Date: Wed, 4 Sep 2024 13:20:15 +0000 (+0300) Subject: sysctl parsing: Allow missing space before '=' X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=9d8e3d974a63aeb71ace8e879de0631554d86225;p=kconfig-hardened-check.git sysctl parsing: Allow missing space before '=' --- diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 2f70b4c..e0f1c97 100755 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -206,7 +206,7 @@ def parse_sysctl_file(mode: StrOrNone, parsed_options: Dict[str, str], fname: st sys.exit(f'[!] ERROR: unable to open {fname}, are you sure it exists?') with open(fname, 'r', encoding='utf-8') as f: - sysctl_pattern = re.compile(r"[a-zA-Z0-9/\._-]+ =.*$") + sysctl_pattern = re.compile(r"[a-zA-Z0-9/\._-]+ ?=.*$") for line in f.readlines(): line = line.strip() if not sysctl_pattern.match(line):