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
f84deb81
Commit
f84deb81
authored
Jul 06, 2019
by
dorp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added generic template as fallback
parent
1baed6ba
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
37 deletions
+11
-37
requirements.txt
requirements.txt
+1
-0
code_generation.py
src/latex_code_generation/code_generation.py
+10
-1
rest.py
src/rest_import/rest.py
+0
-2
generic.tex
src/templates/default/generic.tex
+0
-0
software_components.tex
src/templates/default/software_components.tex
+0
-17
source_code_analysis.tex
src/templates/default/source_code_analysis.tex
+0
-17
No files found.
requirements.txt
View file @
f84deb81
requests
pytest
pytest
pytest-pep8
pytest-pep8
pytest-cov
pytest-cov
...
...
src/latex_code_generation/code_generation.py
View file @
f84deb81
...
@@ -13,6 +13,8 @@ from jinja_filters.filter import (
...
@@ -13,6 +13,8 @@ from jinja_filters.filter import (
)
)
from
rest_import.rest
import
create_request_url
,
request_firmware_data
from
rest_import.rest
import
create_request_url
,
request_firmware_data
GENERIC_TEMPLATE
=
'generic.tex'
def
_set_jinja_env
(
templates_to_use
=
'default'
):
def
_set_jinja_env
(
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
)
...
@@ -54,11 +56,18 @@ def generate_main_code(firmware_analyses, firmware_meta_data, jinja_environment)
...
@@ -54,11 +56,18 @@ def generate_main_code(firmware_analyses, firmware_meta_data, jinja_environment)
def
generate_analysis_codes
(
environment
,
analysis
):
def
generate_analysis_codes
(
environment
,
analysis
):
return
[(
'{}.tex'
.
format
(
analysis_plugin
),
_render_analysis_result
(
analysis
[
analysis_plugin
],
environment
,
analysis_plugin
))
for
analysis_plugin
in
analysis
]
return
[
(
'{}.tex'
.
format
(
analysis_plugin
),
_render_analysis_result
(
analysis
[
analysis_plugin
],
environment
,
analysis_plugin
))
for
analysis_plugin
in
analysis
]
def
_render_analysis_result
(
analysis
,
environment
,
analysis_plugin
):
def
_render_analysis_result
(
analysis
,
environment
,
analysis_plugin
):
try
:
template
=
environment
.
get_template
(
'{}.tex'
.
format
(
analysis_plugin
))
template
=
environment
.
get_template
(
'{}.tex'
.
format
(
analysis_plugin
))
except
jinja2
.
TemplateNotFound
:
logging
.
debug
(
'Falling back on generic template for {}'
.
format
(
analysis_plugin
))
template
=
environment
.
get_template
(
GENERIC_TEMPLATE
)
return
template
.
render
(
selected_analysis
=
analysis
)
return
template
.
render
(
selected_analysis
=
analysis
)
...
...
src/rest_import/rest.py
View file @
f84deb81
import
json
import
requests
import
requests
...
...
src/templates/default/
known_vulnerabilities
.tex
→
src/templates/default/
generic
.tex
View file @
f84deb81
File moved
src/templates/default/software_components.tex
deleted
100644 → 0
View file @
1baed6ba
\begin{longtable}
{
|p
{
3cm
}
|p
{
11.5cm
}
|
}
\hline
Time of Analysis
&
\VAR
{
selected
_
analysis['analysis
_
date'] | nice
_
unix
_
time
}
\\
\hline
Plugin Version
&
\VAR
{
selected
_
analysis['plugin
_
version']
}
\\
\hline
\BLOCK
{
if selected
_
analysis['summary']
}
Summary
\BLOCK
{
for selected
_
summary in selected
_
analysis['summary']
}
&
\VAR
{
selected
_
summary | filter
_
chars
}
\\
\BLOCK
{
endfor
}
\hline
\BLOCK
{
endif
}
\end{longtable}
\ No newline at end of file
src/templates/default/source_code_analysis.tex
deleted
100644 → 0
View file @
1baed6ba
\begin{longtable}
{
|p
{
3cm
}
|p
{
11.5cm
}
|
}
\hline
Time of Analysis
&
\VAR
{
selected
_
analysis['analysis
_
date'] | nice
_
unix
_
time
}
\\
\hline
Plugin Version
&
\VAR
{
selected
_
analysis['plugin
_
version']
}
\\
\hline
\BLOCK
{
if selected
_
analysis['summary']
}
Summary
\BLOCK
{
for selected
_
summary in selected
_
analysis['summary']
}
&
\VAR
{
selected
_
summary | filter
_
chars
}
\\
\BLOCK
{
endfor
}
\hline
\BLOCK
{
endif
}
\end{longtable}
\ No newline at end of file
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