X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=kernel_hardening_checker%2F__init__.py;h=043dae8c8362b446e9a25e9291d4e095c7e85d9d;hb=d38ec317bd74b6144164346314599ddf391f2a32;hp=67e02690bee12aa8b6934f5ec3c7ee91cab044c0;hpb=20c636e47eaabf1cc40aad99d3138ffbb0a27f2f;p=kconfig-hardened-check.git diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py old mode 100644 new mode 100755 index 67e0269..043dae8 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -116,12 +116,12 @@ def print_checklist(mode: StrOrNone, checklist: List[ChecklistObjType], with_res ok_count += 1 if mode == 'show_fail': continue - elif opt.result.startswith('FAIL'): + else: + assert(opt.result.startswith('FAIL')), \ + f'unexpected result "{opt.result}" of {opt.name} check' fail_count += 1 if mode == 'show_ok': continue - else: - assert(False), f'unexpected result "{opt.result}" of {opt.name} check' opt.table_print(mode, with_results) print() if mode == 'verbose': @@ -174,6 +174,9 @@ def parse_cmdline_file(mode: StrOrNone, parsed_options: Dict[str, str], fname: s with open(fname, 'r', encoding='utf-8') as f: line = f.readline() + if not line: + sys.exit(f'[!] ERROR: empty "{fname}"') + opts = line.split() line = f.readline()