import json
from .__about__ import __version__
from .checks import add_kconfig_checks, add_cmdline_checks, normalize_cmdline_options, add_sysctl_checks
-from .engine import StrOrNone, TupleOrNone, print_unknown_options, populate_with_data, perform_checks, override_expected_value
+from .engine import StrOrNone, TupleOrNone, ChecklistObjType, print_unknown_options, populate_with_data, perform_checks, override_expected_value
def _open(file: str, *args, **kwargs) -> TextIO:
sys.exit(f'[!] ERROR: invalid GCC_VERSION and CLANG_VERSION: {gcc_version} {clang_version}')
-def print_checklist(mode: StrOrNone, checklist: List, with_results: bool) -> None:
+def print_checklist(mode: StrOrNone, checklist: List[ChecklistObjType], with_results: bool) -> None:
if mode == 'json':
output = []
for opt in checklist:
if mode != 'json':
print(f'[+] Special report mode: {mode}')
- config_checklist = [] # type: List
+ config_checklist = [] # type: List[ChecklistObjType]
if args.config:
if args.print:
# pylint: disable=missing-function-docstring,line-too-long,invalid-name
# pylint: disable=too-many-branches,too-many-statements,too-many-locals
-from .engine import StrOrNone, KconfigCheck, CmdlineCheck, SysctlCheck, VersionCheck, OR, AND
+from .engine import StrOrNone, ChecklistObjType, KconfigCheck, CmdlineCheck, SysctlCheck, VersionCheck, OR, AND
from typing import List
-def add_kconfig_checks(l: List, arch: str) -> None:
+def add_kconfig_checks(l: List[ChecklistObjType], arch: str) -> None:
assert(arch), 'empty arch'
# Calling the KconfigCheck class constructor:
l += [KconfigCheck('harden_userspace', 'a13xp0p0v', 'X86_USER_SHADOW_STACK', 'y')]
-def add_cmdline_checks(l: List, arch: str) -> None:
+def add_cmdline_checks(l: List[ChecklistObjType], arch: str) -> None:
assert(arch), 'empty arch'
# Calling the CmdlineCheck class constructor:
# kernel.warn_limit (think about a proper value)
# net.ipv4.tcp_syncookies=1 (?)
-def add_sysctl_checks(l: List, _arch: StrOrNone) -> None:
+def add_sysctl_checks(l: List[ChecklistObjType], _arch: StrOrNone) -> None:
# This function may be called with arch=None
# Calling the SysctlCheck class constructor:
populate_opt_with_data(o, data, data_type)
-def populate_with_data(checklist: List, data: TupleOrOrderedDict, data_type: str) -> None:
+def populate_with_data(checklist: List[ChecklistObjType], data: TupleOrOrderedDict, data_type: str) -> None:
for opt in checklist:
populate_opt_with_data(opt, data, data_type)
-def override_expected_value(checklist: List, name: str, new_val: str) -> None:
+def override_expected_value(checklist: List[ChecklistObjType], name: str, new_val: str) -> None:
for opt in checklist:
if opt.name == name:
assert(opt.opt_type in ('kconfig', 'cmdline', 'sysctl')), \
opt.expected = new_val
-def perform_checks(checklist: List) -> None:
+def perform_checks(checklist: List[ChecklistObjType]) -> None:
for opt in checklist:
opt.check()
-def print_unknown_options(checklist: List, parsed_options: OrderedDict[str, str], opt_type: str) -> None:
+def print_unknown_options(checklist: List[ChecklistObjType], parsed_options: OrderedDict[str, str], opt_type: str) -> None:
known_options = []
for o1 in checklist: