BOAR - Basic HTML¶
This file contains the implementation of the necessary methods of the report abstract class. This report class uses HTML files to report about the found threats.
- class reports.boar_basic_html.BOARBasicHTML(severity_enum, args)¶
BOARBasicHTML class.
It implements the necessary methods to alert about the found threats and interact with the HTML file.
- display(who, display=True)¶
It creates the HTML table for 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 in HTML format
- 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. All in HTML format.
- 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 in HTML format.
- 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 in HTML format
- Return type
str
- save_html(inner_html)¶
It saves the HTML content in the expectified file.
Args “absolute_path” and “filename” has to be defined in the rules file.
- Parameters
inner_html (str) – HTML content.