You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
705 B
Python
26 lines
705 B
Python
2 years ago
|
#!/usr/bin/env python3
|
||
|
|
||
|
"""
|
||
|
Helper file to define all the possible formats in.
|
||
|
|
||
|
All formats get an iterable of taints and the taint table and output a single string of result.
|
||
|
"""
|
||
|
|
||
|
def chktaint_format(taints, _table):
|
||
|
_chktaint_fmt = ' * {taint.description} (#{taint.position})'
|
||
|
if taints:
|
||
|
# TODO: Prolog and epilog?
|
||
|
result = [_chktaint_fmt.format(taint=t) for t in taints]
|
||
|
else:
|
||
|
result = ['Kernel not tainted']
|
||
|
return '\n'.join(result)
|
||
|
|
||
|
def bit_format(taints, _table):
|
||
|
return ','.join(str(t.position) for t in taints)
|
||
|
|
||
|
def letter_format(taints, table):
|
||
|
return '\''+table.get_taint_letters(taints)+'\''
|
||
|
|
||
|
def description_format(taints, _table):
|
||
|
return '\n'.join(t.description for t in taints)
|