-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))
+def print_checklist(checklist, with_results):
+ if json_mode:
+ opts = []
+ for o in checklist:
+ opt = ['CONFIG_'+o.name, o.expected, o.decision, o.reason]
+ if with_results:
+ opt.append(o.result)
+ opts.append(opt)
+ print(json.dumps(opts))
+ return
+
+ # header
+ print('{:^40}|{:^13}|{:^10}|{:^20}'.format('option name', 'desired val', 'decision', 'reason'), end='')
+ sep_line_len = 86
+ if with_results:
+ print('||{:^28}'.format('check result'), end='')
+ sep_line_len += 30