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
402a2348
Commit
402a2348
authored
Jul 20, 2020
by
lwilms
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
char escape & added cve_lookup
parent
c7468cc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
main.tex
pdf_generator/templates/default/main.tex
+23
-7
template_engine.py
pdf_generator/tex_generation/template_engine.py
+13
-1
No files found.
pdf_generator/templates/default/main.tex
View file @
402a2348
...
...
@@ -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
}
...
...
pdf_generator/tex_generation/template_engine.py
View file @
402a2348
...
...
@@ -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
:
...
...
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