-def print_checklist(arch):
- print('[+] Printing kernel hardening preferences for {}...'.format(arch))
- print('{:^40}|{:^13}|{:^10}|{:^20}'.format(
- 'option name', 'desired val', 'decision', 'reason'))
- print('=' * 87)
- for opt in checklist:
- print('CONFIG_{:<33}|{:^13}|{:^10}|{:^20}'.format(
- opt.name, opt.expected, opt.decision, opt.reason))
- print()
+def print_checks(arch=None):
+ if json_mode:
+ opts = []
+ for o in checklist:
+ opt = ['CONFIG_'+o.name, o.expected, o.decision, o.reason]
+ if not arch:
+ opt.append(o.result)
+ opts.append(opt)
+ print(opts)
+ else:
+ if arch:
+ print('[+] Printing kernel hardening preferences for {}...'.format(arch))
+
+ # header
+ print('{:^40}|{:^13}|{:^10}|{:^20}'.format('option name', 'desired val', 'decision', 'reason'), end='')
+ sep_line_len = 87
+ if not arch:
+ print('||{:^28}'.format('check result'), end='')
+ sep_line_len = 116
+ print()