Commit 402a2348 by lwilms

char escape & added cve_lookup

parent c7468cc5
......@@ -79,13 +79,29 @@ No Crypto
% Known Vulnerabilities
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'known_vulnerabilities' in analysis}
\section{Known Vulnerabilities}
\BLOCK{if analysis['known_vulnerabilities']['summary'] | length}
\section{Known Vulnerabilities}
\begin{twentyshort}
\BLOCK{for known_vullies in analysis['known_vulnerabilities']['summary']}
\twentyitemshort{\VAR{known_vullies | filter_chars}}{}
\BLOCK{endfor}
\end{twentyshort}
\begin{twentyshort}
\BLOCK{for known_vullies in analysis['known_vulnerabilities']['summary']}
\twentyitemshort{\VAR{known_vullies | filter_chars}}{}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}
\BLOCK{endif}\\
% ----------------------------------------------------------------------------------------------------------------------
% CVE Lookup
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK{if 'cve_lookup' in analysis}
\BLOCK{if analysis['cve_lookup']['summary'] | length}
\section{CVE Lookup}
\begin{twentyshort}
\BLOCK{for cve in analysis['cve_lookup']['summary'] | cve_crits}
\twentyitemshort{\VAR{cve | filter_chars}}{}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}
\BLOCK{endif}\\
% ----------------------------------------------------------------------------------------------------------------------
% Top 5 File Types
......@@ -105,7 +121,7 @@ No Crypto
\begin{twentyshort}
\BLOCK{for selected_analysis in analysis['ip_and_uri_finder']['summary'] | triplet}
\twentyitemshort{\VAR{selected_analysis}}
\twentyitemshort{\VAR{selected_analysis | filter_chars}}
\BLOCK{endfor}
\end{twentyshort}
\BLOCK{endif}
......
......@@ -139,7 +139,7 @@ def software_components(software_string):
software, ver_number = _larger_two_components(split_software_string)
elif len(split_software_string[1]) > 0:
software, ver_number = _less_three_components(split_software_string)
return f'{ver_number}}}{{{software}'
return f'{ver_number}}}{{{replace_special_characters(software)}'
def _less_three_components(software_string):
......@@ -203,6 +203,17 @@ def get_x_entries(summary, how_many=10):
return summary[:how_many]
def cve_criticals(summary):
f_string = []
else_count = len(summary)
for cve in summary:
if 'CRITICAL' in cve:
f_string.append(cve)
else_count -= 1
f_string.append(f'and {else_count} other uncritical')
return f_string
def _add_filters_to_jinja(environment):
environment.filters['number_format'] = render_number_as_size
environment.filters['nice_unix_time'] = render_unix_time
......@@ -215,6 +226,7 @@ def _add_filters_to_jinja(environment):
environment.filters['split_space'] = software_components
environment.filters['triplet'] = get_triples
environment.filters['x_entires'] = get_x_entries
environment.filters['cve_crits'] = cve_criticals
class TemplateEngine:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment