Commit 79783e9c by dorp

added better template for exploit mitigations

parent 040dcaec
...@@ -6,7 +6,7 @@ DEFAULT_URL = 'http://localhost:5000' ...@@ -6,7 +6,7 @@ DEFAULT_URL = 'http://localhost:5000'
def create_request_url(firmware_uid, server_url): def create_request_url(firmware_uid, server_url):
return '{}/rest/firmware/{}'.format(server_url if server_url else DEFAULT_URL, firmware_uid) return '{}/rest/firmware/{}?summary=true'.format(server_url if server_url else DEFAULT_URL, firmware_uid)
def request_firmware_data(request_url): def request_firmware_data(request_url):
......
...@@ -7,10 +7,38 @@ ...@@ -7,10 +7,38 @@
\hline \hline
\BLOCK{if selected_analysis['summary']} \BLOCK{if selected_analysis['summary']}
Summary NX
&
\BLOCK{for selected_summary in selected_analysis['summary']} \BLOCK{for selected_summary in selected_analysis['summary']}
& \VAR{selected_summary | filter_chars} \\ \BLOCK{if selected_summary | contains('NX')}
\BLOCK{endfor} \VAR{selected_summary | filter_chars} (\VAR{ selected_analysis['summary'][selected_summary] | elements_count })
\BLOCK{endif}
\BLOCK{endfor} \\
\hline
Canary
&
\BLOCK{for selected_summary in selected_analysis['summary']}
\BLOCK{if selected_summary | contains('Canary')}
\VAR{selected_summary | filter_chars} (\VAR{ selected_analysis['summary'][selected_summary] | elements_count })
\BLOCK{endif}
\BLOCK{endfor} \\
\hline \hline
PIE
&
\BLOCK{for selected_summary in selected_analysis['summary']}
\BLOCK{if selected_summary | contains('PIE')}
\VAR{selected_summary | filter_chars} (\VAR{ selected_analysis['summary'][selected_summary] | elements_count })
\BLOCK{endif}
\BLOCK{endfor} \\
\hline
RELRO
&
\BLOCK{for selected_summary in selected_analysis['summary']}
\BLOCK{if selected_summary | contains('RELRO')}
\VAR{selected_summary | filter_chars} (\VAR{ selected_analysis['summary'][selected_summary] | elements_count })
\BLOCK{endif}
\BLOCK{endfor} \\
\hline
\BLOCK{endif} \BLOCK{endif}
\end{longtable} \end{longtable}
...@@ -98,6 +98,12 @@ def split_output_lines(output_value, max_length=92): ...@@ -98,6 +98,12 @@ def split_output_lines(output_value, max_length=92):
return output return output
def item_contains_string(item, string):
if not isinstance(item, str):
return False
return string in item
def create_jinja_environment(templates_to_use='default'): def create_jinja_environment(templates_to_use='default'):
template_directory = Path(Path(__file__).parent.parent, 'templates', templates_to_use) template_directory = Path(Path(__file__).parent.parent, 'templates', templates_to_use)
environment = jinja2.Environment( environment = jinja2.Environment(
...@@ -128,6 +134,7 @@ def _add_filters_to_jinja(environment): ...@@ -128,6 +134,7 @@ def _add_filters_to_jinja(environment):
environment.filters['filter_list'] = filter_chars_in_list environment.filters['filter_list'] = filter_chars_in_list
environment.filters['split_hash'] = split_hash environment.filters['split_hash'] = split_hash
environment.filters['split_output_lines'] = split_output_lines environment.filters['split_output_lines'] = split_output_lines
environment.filters['contains'] = item_contains_string
class Engine: class Engine:
......
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