From 03863c01dccde72aefe8f4561c744af52710190a Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 9 Mar 2024 20:24:07 +0300 Subject: [PATCH] Skip the kernel version part after '-' Example: # Linux/x86_64 6.7.4-200.fc39.x86_64 Kernel Configuration Refers to #88, #89, #97 --- kernel_hardening_checker/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 2fa789d..4855a59 100644 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -53,7 +53,7 @@ def detect_kernel_version(fname): if ver_pattern.match(line): line = line.strip() parts = line.split() - ver_str = parts[2] + ver_str = parts[2].split('-', 1)[0] ver_numbers = ver_str.split('.') if len(ver_numbers) < 3 or not ver_numbers[0].isdigit() or not ver_numbers[1].isdigit(): msg = f'failed to parse the version "{ver_str}"' -- 2.31.1