BOAR - Stdout¶
This file contains the BOARStdout class, which inherits from the abstract Report class. This base has the goal of report the found threats using the standard output. It is a basic way of report the threats.
- class reports.boar_stdout.BOARStdout(severity_enum, args)¶
BOARStdout class.
It implements the necessary methods to initialize, fill and display the threats report after the analysis.
- display(who, display=True)¶
It displays all the threats from a concrete module.
- Parameters
who (str) – the module which found the threat.
display (bool) – if True, it displays the threat.
- Raises
BOAReportWhoNotFound – if the given module is not found.
- Returns
text to be displayed
- Return type
str
- display_all(print_summary=True, display=True)¶
It displays all the threats from all the modules. Moreover, it prints a summary at the end optionally.
- Parameters
print_summary (bool) – if True, it prints a summary with statistics about all the found threats.
display (bool) – if True, it displays the threat.
- Returns
text to be displayed
- Return type
str
- pretty_print_tuple(t, first_time=False, reported_by=False, display=True)¶
It prints a pretty line about a found threat record.
The expected format for the tuple is next:
str: module who raised the threat.
str: threat description.
SeverityBase: threat severity.
str (optional): advice for solving the threat. If it is not provided, the string “not specified” will be displayed.
int (optional): threat row. If it is not provided, the value -1 will be displayed.
int (optional): threat col. If it is not provided, the value -1 will be displayed.
- type: SeverityBase type which will be used to display
the severity. This value is intented to be able to join different Report instances.
- Parameters
t (tuple) – threat record.
first_time (bool) – if you want to display a pretty box around the module name who raised the threat, this value must be True. The default value is False.
reported_by (bool) – if you want to display the module who raised the threat, this value must be True. This arg should be used when you want to avoid the arg first_time. The default value is False.
display (bool) – if True, it displays the threat.
- Returns
text to be displayed
- Return type
str
Note
If you want to show orderly the threats, you should use first_time=True for the first record and first_time=False for the rest. If you do not want to show it orderly, you should use reported_by=True.