Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fact_pdf_report
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
fact_pdf_report
Commits
5f120d9d
Commit
5f120d9d
authored
Jun 08, 2020
by
lwilms
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
almost there with exploit mitigation
parent
fca270f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
11 deletions
+55
-11
main.tex
pdf_generator/templates/new_template/main.tex
+12
-11
template_engine.py
pdf_generator/tex_generation/template_engine.py
+43
-0
No files found.
pdf_generator/templates/new_template/main.tex
View file @
5f120d9d
...
...
@@ -41,8 +41,9 @@
\BLOCK
{
endif
}
}
\skills
{{}
\BLOCK
{
for selected
_
summary in analysis['exploit
_
mitigations']['summary'] | sort
}
,
{
\VAR
{
selected
_
summary | filter
_
chars
}
/
\VAR
{
analysis['exploit
_
mitigations']['summary'][selected
_
summary]|elements
_
count *6/analysis['exploit
_
mitigations']['count']
}}
\BLOCK
{
endfor
}
}
\skills
{
\VAR
{
analysis | call
_
for
_
mitigations
}}
%#\skills{\BLOCK{for selected_summary in analysis['exploit_mitigations']['summary'] | sort},{\VAR{selected_summary | filter_chars }/\VAR{analysis['exploit_mitigations']['summary'][selected_summary]|elements_count *6/analysis['exploit_mitigations']['count']}}\BLOCK{endfor}}
\makeprofile
% ----------------------------------------------------------------------------------------------------------------------
...
...
@@ -102,15 +103,15 @@
% ----------------------------------------------------------------------------------------------------------------------
% ELF ANALYSIS
% ----------------------------------------------------------------------------------------------------------------------
\BLOCK
{
if 'elf
_
analysis' in analysis
}
\section
{
ELF Analysis
}
\begin{twentyshort}
\BLOCK
{
for ELF in analysis['elf
_
analysis']['summary'] | top
_
five(20)
}
\twentyitemshort
{
\VAR
{
analysis['elf
_
analysis']['summary'][ELF] | elements
_
count
}}{
\VAR
{
ELF | filter
_
chars
}}
\BLOCK
{
endfor
}
\end{twentyshort}
\BLOCK
{
endif
}
%\BLOCK{if 'elf_analysis' in analysis
}
%
\section{ELF Analysis}
%
%
\begin{twentyshort}
%
\BLOCK{for ELF in analysis['elf_analysis']['summary'] | top_five(20)}
%
\twentyitemshort{\VAR{analysis['elf_analysis']['summary'][ELF] | elements_count}}{\VAR{ELF | filter_chars}}
%
\BLOCK{endfor}
%
\end{twentyshort}
%
\BLOCK{endif}
% ----------------------------------------------------------------------------------------------------------------------
% IP & URI
% ----------------------------------------------------------------------------------------------------------------------
...
...
pdf_generator/tex_generation/template_engine.py
View file @
5f120d9d
...
...
@@ -137,6 +137,48 @@ def get_five_longest_entries(summary, top=5):
return
sorted_summary
def
exploit_mitigation
(
summary
):
summary
=
summary
[
'exploit_mitigations'
][
'summary'
]
max_count
=
count_mitigations
(
summary
)
*
6
# skillsbar is maxed out at 6
pie_num
,
canary_num
,
relro_num
,
nx_num
,
fortify_num
=
0
,
0
,
0
,
0
,
0
for
selected_summary
in
summary
:
if
'PIE'
in
selected_summary
and
(
'disabled'
in
selected_summary
or
'invalid'
in
selected_summary
):
pie_num
+=
len
(
summary
[
selected_summary
])
if
'RELRO'
in
selected_summary
and
'disabled'
in
selected_summary
:
relro_num
+=
len
(
summary
[
selected_summary
])
if
'CANARY'
in
selected_summary
and
'disabled'
in
selected_summary
:
canary_num
+=
len
(
summary
[
selected_summary
])
if
'NX'
in
selected_summary
and
'disabled'
in
selected_summary
:
nx_num
+=
len
(
summary
[
selected_summary
])
if
'FORTIFY'
in
selected_summary
and
'disabled'
in
selected_summary
:
fortify_num
+=
len
(
summary
[
selected_summary
])
return
'{0}{2}/{3}{1},{0}{4}/{5}{1},{0}{6}/{7}{1},{0}{8}/{9}{1}'
.
format
(
'{'
,
'}'
,
'CANARY'
,
canary_num
/
max_count
,
'PIE'
,
pie_num
/
max_count
,
'RELRO'
,
relro_num
/
max_count
,
'NX'
,
nx_num
/
max_count
,
'FORTIFY_SOURCE'
,
fortify_num
/
max_count
)
# exp mitigation: PIE disabled + invalid
# RELRO partially + fully
def
count_mitigations
(
summary
):
for
mitigation
in
[
'Canary'
,
'NX'
,
'RELRO'
,
'PIE'
,
'FORTIFY'
]:
count
=
count_this_mitigation
(
summary
,
mitigation
)
if
count
!=
0
:
return
count
return
count
def
count_this_mitigation
(
summary
,
mitigation
):
count
=
0
for
selected_summary
in
summary
:
if
mitigation
in
selected_summary
:
count
+=
len
(
summary
[
selected_summary
])
return
count
def
_add_filters_to_jinja
(
environment
):
environment
.
filters
[
'number_format'
]
=
render_number_as_size
environment
.
filters
[
'nice_unix_time'
]
=
render_unix_time
...
...
@@ -152,6 +194,7 @@ def _add_filters_to_jinja(environment):
environment
.
filters
[
'contains'
]
=
item_contains_string
environment
.
filters
[
'top_five'
]
=
get_five_longest_entries
environment
.
filters
[
'sort'
]
=
sorted
environment
.
filters
[
'call_for_mitigations'
]
=
exploit_mitigation
class
TemplateEngine
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment