Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Paas CI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
INFN Cloud
Paas CI
Commits
18f7f7d8
Commit
18f7f7d8
authored
1 year ago
by
Gioacchino Vino
Browse files
Options
Downloads
Plain Diff
Merge branch 'debug_paas_ci' into 'main'
Reviewed scan python code See merge request
!112
parents
bf14cf90
69e80a44
No related branches found
Branches containing commit
No related tags found
1 merge request
!112
Reviewed scan python code
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
files/gvm_library.py
+4
-4
4 additions, 4 deletions
files/gvm_library.py
files/scan.py
+5
-2
5 additions, 2 deletions
files/scan.py
with
9 additions
and
6 deletions
files/gvm_library.py
+
4
−
4
View file @
18f7f7d8
...
@@ -207,13 +207,13 @@ class Task:
...
@@ -207,13 +207,13 @@ class Task:
logging
.
debug
(
f
"
Waiting for the task ends. Now
{
int
(
time
()
-
start_time
)
}
s from start. Status:
{
self
.
status
}
"
)
logging
.
debug
(
f
"
Waiting for the task ends. Now
{
int
(
time
()
-
start_time
)
}
s from start. Status:
{
self
.
status
}
"
)
sleep
(
10
)
sleep
(
10
)
def
save_report
(
self
,
report_
format
:
str
,
report_
filename
:
str
):
def
save_report
(
self
,
format
:
str
,
filename
:
str
):
res
=
self
.
client
.
get_report
(
self
.
report_id
,
res
=
self
.
client
.
get_report
(
self
.
report_id
,
report_format_id
=
report_
format
,
report_format_id
=
format
,
ignore_pagination
=
True
,
ignore_pagination
=
True
,
details
=
"
1
"
)
details
=
True
)
code
=
str
(
res
.
xpath
(
'
report/text()
'
)[
0
])
code
=
str
(
res
.
xpath
(
'
report/text()
'
)[
0
])
with
open
(
report_
filename
,
"
wb
"
)
as
fh
:
with
open
(
filename
,
"
wb
"
)
as
fh
:
fh
.
write
(
base64
.
b64decode
(
code
))
fh
.
write
(
base64
.
b64decode
(
code
))
def
get_report_info
(
self
)
->
Dict
:
def
get_report_info
(
self
)
->
Dict
:
...
...
This diff is collapsed.
Click to expand it.
files/scan.py
+
5
−
2
View file @
18f7f7d8
...
@@ -76,7 +76,7 @@ for host,ports in endpoints.items():
...
@@ -76,7 +76,7 @@ for host,ports in endpoints.items():
target_name
=
f
"
{
auth_name
}
_target_
{
host
}
"
target_name
=
f
"
{
auth_name
}
_target_
{
host
}
"
task_name
=
f
"
{
auth_name
}
_task_
{
host
}
"
task_name
=
f
"
{
auth_name
}
_task_
{
host
}
"
port_list_name
=
f
"
{
auth_name
}
_pl_
{
host
}
"
port_list_name
=
f
"
{
auth_name
}
_pl_
{
host
}
"
report_filename
=
f
"
{
output_dir
}
/
{
host
}
-report
.pdf
"
report_filename
=
f
"
{
output_dir
}
/
{
host
}
-report
"
summary_filename
=
f
"
{
output_dir
}
/summary-report.json
"
summary_filename
=
f
"
{
output_dir
}
/summary-report.json
"
port_list
=
gvm_client
.
get_or_create_port_list
(
port_list_name
,
ports
)
port_list
=
gvm_client
.
get_or_create_port_list
(
port_list_name
,
ports
)
...
@@ -91,7 +91,10 @@ for host,ports in endpoints.items():
...
@@ -91,7 +91,10 @@ for host,ports in endpoints.items():
if
task
.
status
==
'
New
'
:
if
task
.
status
==
'
New
'
:
task
.
start
()
task
.
start
()
if
task
.
wait
(
WAIT_TIMEOUT
):
if
task
.
wait
(
WAIT_TIMEOUT
):
task
.
save_report
(
ReportFormats
.
pdf
,
report_filename
)
task
.
save_report
(
format
=
ReportFormats
.
pdf
,
filename
=
f
"
{
report_filename
}
.pdf
"
)
task
.
save_report
(
format
=
ReportFormats
.
txt
,
filename
=
f
"
{
report_filename
}
.txt
"
)
reports
[
host
]
=
task
.
get_report_info
()
reports
[
host
]
=
task
.
get_report_info
()
else
:
else
:
reports
[
host
]
=
f
"
ERROR Task:
{
task
.
id
}
"
reports
[
host
]
=
f
"
ERROR Task:
{
task
.
id
}
"
...
...
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