From 16b5717331b3b232d3e8ff62b3e86ba27914db87 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sat, 16 Nov 2024 16:12:17 +0300 Subject: [PATCH] Handle the case of denied permission in the autodetect mode --- kernel_hardening_checker/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 87b6e77..58c3843 100755 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -38,6 +38,8 @@ def _open(file: str) -> TextIO: return open(file, 'rt', encoding='utf-8') except FileNotFoundError: sys.exit(f'[!] ERROR: unable to open {file}, are you sure it exists?') + except PermissionError: + sys.exit(f'[!] ERROR: unable to open {file}, permission denied') def detect_kconfig(version_fname: str) -> Tuple[StrOrNone, str]: -- 2.31.1