Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flan
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
flan
Commits
747a935f
Commit
747a935f
authored
5 years ago
by
shadow
Browse files
Options
Downloads
Patches
Plain Diff
fixed duplicated vulnerabilities
parent
dc4ba77d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
parsers/flan_xml_parser.py
+4
-2
4 additions, 2 deletions
parsers/flan_xml_parser.py
report_builders/latex_report_builder.py
+4
-6
4 additions, 6 deletions
report_builders/latex_report_builder.py
with
8 additions
and
8 deletions
parsers/flan_xml_parser.py
+
4
−
2
View file @
747a935f
...
@@ -73,6 +73,7 @@ class FlanXmlParser:
...
@@ -73,6 +73,7 @@ class FlanXmlParser:
self
.
parse_vuln
(
app_name
,
vuln
[
'
elem
'
])
self
.
parse_vuln
(
app_name
,
vuln
[
'
elem
'
])
else
:
else
:
self
.
parse_vuln
(
app_name
,
script_table
[
'
elem
'
])
self
.
parse_vuln
(
app_name
,
script_table
[
'
elem
'
])
pass
def
parse_port
(
self
,
ip_addr
:
str
,
port
:
Dict
[
str
,
Any
]):
def
parse_port
(
self
,
ip_addr
:
str
,
port
:
Dict
[
str
,
Any
]):
if
port
[
'
state
'
][
'
@state
'
]
==
'
closed
'
:
if
port
[
'
state
'
][
'
@state
'
]
==
'
closed
'
:
...
@@ -80,9 +81,10 @@ class FlanXmlParser:
...
@@ -80,9 +81,10 @@ class FlanXmlParser:
app_name
=
self
.
get_app_name
(
port
[
'
service
'
])
app_name
=
self
.
get_app_name
(
port
[
'
service
'
])
port_num
=
port
[
'
@portid
'
]
port_num
=
port
[
'
@portid
'
]
new_app
=
app_name
not
in
self
.
results
self
.
results
[
app_name
].
locations
[
ip_addr
].
append
(
port_num
)
self
.
results
[
app_name
].
locations
[
ip_addr
].
append
(
port_num
)
if
'
script
'
in
port
:
if
new_app
and
'
script
'
in
port
:
# vulnerabilities parsed only if this app didn't appear before
scripts
=
port
[
'
script
'
]
scripts
=
port
[
'
script
'
]
if
isinstance
(
scripts
,
list
):
if
isinstance
(
scripts
,
list
):
for
s
in
scripts
:
for
s
in
scripts
:
...
...
This diff is collapsed.
Click to expand it.
report_builders/latex_report_builder.py
+
4
−
6
View file @
747a935f
...
@@ -47,8 +47,7 @@ class LatexReportBuilder(ReportBuilder):
...
@@ -47,8 +47,7 @@ class LatexReportBuilder(ReportBuilder):
self
.
_append
(
'
\\
begin{figure}[h!]
\n
'
)
self
.
_append
(
'
\\
begin{figure}[h!]
\n
'
)
self
.
_append
(
'
\\
begin{tabular}{|p{16cm}|}
\\
rowcolor[HTML]{
'
self
.
_append
(
'
\\
begin{tabular}{|p{16cm}|}
\\
rowcolor[HTML]{
'
+
self
.
colors
[
severity_name
]
+
self
.
colors
[
severity_name
]
+
'''
}
\\
begin{tabular}{@{}p{15cm}>{
\\
raggedleft
\\
arraybackslash}
+
'
}
\\
begin{tabular}{@{}p{15cm}>{
\\
raggedleft
\\
arraybackslash} p{0.5cm}@{}}
\\
textbf{
'
p{0.5cm}@{}}
\\
textbf{
'''
+
v
.
name
+
'
'
+
severity_name
+
'
(
'
+
v
.
name
+
'
'
+
severity_name
+
'
(
'
+
str
(
v
.
severity
)
+
str
(
v
.
severity
)
+
'
)} & \href{https://nvd.nist.gov/vuln/detail/
'
+
'
)} & \href{https://nvd.nist.gov/vuln/detail/
'
...
@@ -60,8 +59,7 @@ class LatexReportBuilder(ReportBuilder):
...
@@ -60,8 +59,7 @@ class LatexReportBuilder(ReportBuilder):
self
.
_append
(
'
\FloatBarrier
\n\\
textbf{The above
'
self
.
_append
(
'
\FloatBarrier
\n\\
textbf{The above
'
+
str
(
num_vulns
)
+
str
(
num_vulns
)
+
'''
vulnerabilities apply to these network locations:}
\n
+
'
vulnerabilities apply to these network locations:}
\n\\
begin{itemize}
\n
'
)
\\
begin{itemize}
\n
'''
)
for
addr
in
locations
:
for
addr
in
locations
:
self
.
_append
(
'
\item
'
+
addr
+
'
Ports:
'
+
str
(
locations
[
addr
])
+
'
\n
'
)
self
.
_append
(
'
\item
'
+
addr
+
'
Ports:
'
+
str
(
locations
[
addr
])
+
'
\n
'
)
self
.
_append
(
'
\\\\
\\\\
\n
\end{itemize}
\n
'
)
self
.
_append
(
'
\\\\
\\\\
\n
\end{itemize}
\n
'
)
...
@@ -77,8 +75,8 @@ class LatexReportBuilder(ReportBuilder):
...
@@ -77,8 +75,8 @@ class LatexReportBuilder(ReportBuilder):
self
.
_append
(
'
\end{enumerate}
\n
'
)
self
.
_append
(
'
\end{enumerate}
\n
'
)
def
initialize_section
(
self
):
def
initialize_section
(
self
):
self
.
_append
(
'
''
\\
begin{enumerate}[wide, labelwidth=!, labelindent=0pt,
self
.
_append
(
'
\\
begin{enumerate}[wide, labelwidth=!, labelindent=0pt,
label=
\\
textbf{\large
\\
arabic{enumi}
'
label=
\\
textbf{\large
\\
arabic{enumi}
\large}]
\n
'
''
)
'
\large}]
\n
'
)
def
add_vulnerable_section
(
self
):
def
add_vulnerable_section
(
self
):
self
.
_append
(
'
\section*{Services with Vulnerabilities}
'
)
self
.
_append
(
'
\section*{Services with Vulnerabilities}
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment