json_mode = False
supported_archs = [ 'X86_64', 'X86_32', 'ARM64', 'ARM' ]
-config_checklist = []
+
kernel_version = None
opt.check()
-def check_config_file(checklist, fname):
+def check_config_file(checklist, fname, arch):
with open(fname, 'r') as f:
parsed_options = OrderedDict()
opt_is_on = re.compile("CONFIG_[a-zA-Z0-9_]*=[a-zA-Z0-9_\"]*")
print_checklist(checklist, True)
+def main():
+ global debug_mode
+ global json_mode
+ global kernel_version
+
+ config_checklist = []
-if __name__ == '__main__':
parser = ArgumentParser(description='Checks the hardening options in the Linux kernel config')
parser.add_argument('-p', '--print', choices=supported_archs,
help='print hardening preferences for selected architecture')
print('[+] Detected kernel version: {}.{}'.format(kernel_version[0], kernel_version[1]))
construct_checklist(config_checklist, arch)
- check_config_file(config_checklist, args.config)
+ check_config_file(config_checklist, args.config, arch)
error_count = len(list(filter(lambda opt: opt.result.startswith('FAIL'), config_checklist)))
ok_count = len(list(filter(lambda opt: opt.result.startswith('OK'), config_checklist)))
if debug_mode:
sys.exit(0)
parser.print_help()
+
+if __name__ == '__main__':
+ main()