projects
/
kconfig-hardened-check.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d8e3d9
)
sysctl parsing: Allow comments (they usually exist in sysctl.conf)
author
Alexander Popov
<alex.popov@linux.com>
Wed, 4 Sep 2024 13:21:31 +0000
(16:21 +0300)
committer
Alexander Popov
<alex.popov@linux.com>
Wed, 4 Sep 2024 13:21:31 +0000
(16:21 +0300)
kernel_hardening_checker/__init__.py
patch
|
blob
|
history
diff --git
a/kernel_hardening_checker/__init__.py
b/kernel_hardening_checker/__init__.py
index e0f1c97a94e79767b4f840ec18772484132dc5a4..4fe2ef29cfbd4ebd3b443db01974a363a88ff64f 100755
(executable)
--- a/
kernel_hardening_checker/__init__.py
+++ b/
kernel_hardening_checker/__init__.py
@@
-209,6
+209,8
@@
def parse_sysctl_file(mode: StrOrNone, parsed_options: Dict[str, str], fname: st
sysctl_pattern = re.compile(r"[a-zA-Z0-9/\._-]+ ?=.*$")
for line in f.readlines():
line = line.strip()
+ if line.startswith('#'):
+ continue
if not sysctl_pattern.match(line):
sys.exit(f'[!] ERROR: unexpected line in sysctl file: "{line}"')
option, value = line.split('=', 1)