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
cfd27bcf
Commit
cfd27bcf
authored
1 year ago
by
Gioacchino Vino
Browse files
Options
Downloads
Plain Diff
Merge branch 'debug_paas_ci' into 'main'
Changed module names See merge request
!91
parents
25b7cc67
f336431a
No related branches found
No related tags found
1 merge request
!91
Changed module names
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
files/scan.py
+1
-0
1 addition, 0 deletions
files/scan.py
files/scan_gvm_library.py
+9
-30
9 additions, 30 deletions
files/scan_gvm_library.py
with
10 additions
and
30 deletions
files/scan.py
+
1
−
0
View file @
cfd27bcf
...
@@ -65,6 +65,7 @@ endpoints = utilities.import_dep_info(
...
@@ -65,6 +65,7 @@ endpoints = utilities.import_dep_info(
logging
.
info
(
f
"
endpoints:
{
endpoints
}
"
)
logging
.
info
(
f
"
endpoints:
{
endpoints
}
"
)
# test gmp connection
# test gmp connection
gvm_library
.
set_auth
(
auth_name
,
auth_passwd
)
logging
.
info
(
f
"
gvm version:
{
gvm_library
.
get_version
()
}
"
)
logging
.
info
(
f
"
gvm version:
{
gvm_library
.
get_version
()
}
"
)
reports
=
dict
()
reports
=
dict
()
...
...
This diff is collapsed.
Click to expand it.
files/scan_gvm_library.py
+
9
−
30
View file @
cfd27bcf
...
@@ -13,14 +13,21 @@ transform = EtreeTransform()
...
@@ -13,14 +13,21 @@ transform = EtreeTransform()
config
=
{
'
id
'
:
"
9866edc1-8869-4e80-acac-d15d5647b4d9
"
}
config
=
{
'
id
'
:
"
9866edc1-8869-4e80-acac-d15d5647b4d9
"
}
scanner
=
{
'
id
'
:
"
08b69003-5fc2-4037-a479-93b440211c73
"
}
scanner
=
{
'
id
'
:
"
08b69003-5fc2-4037-a479-93b440211c73
"
}
ovs_ssh_credential
=
{
'
id
'
:
"
b9af5845-8b87-4378-bca4-cee39a894c17
"
}
ovs_ssh_credential
=
{
'
id
'
:
"
b9af5845-8b87-4378-bca4-cee39a894c17
"
}
auth_name
,
auth_passwd
=
""
,
""
def
get_version_old
(
auth_name
,
auth_passwd
):
def
set_auth
(
auth_n
,
auth_p
):
global
auth_name
global
auth_passwd
auth_name
=
auth_n
auth_passwd
=
auth_p
def
get_version_old
():
with
Gmp
(
connection
,
transform
=
transform
)
as
gmp
:
with
Gmp
(
connection
,
transform
=
transform
)
as
gmp
:
gmp
.
authenticate
(
auth_name
,
auth_passwd
)
gmp
.
authenticate
(
auth_name
,
auth_passwd
)
pretty_print
(
gmp
.
get_version
())
pretty_print
(
gmp
.
get_version
())
def
create_connection
(
auth_name
,
auth_passwd
):
def
create_connection
():
connection_retries
=
5
connection_retries
=
5
retry
=
connection_retries
retry
=
connection_retries
while
(
retry
>
0
):
while
(
retry
>
0
):
...
@@ -398,31 +405,3 @@ def process_global_reports_info(reports):
...
@@ -398,31 +405,3 @@ def process_global_reports_info(reports):
reports
[
'
global
'
]
=
"
NOK
"
reports
[
'
global
'
]
=
"
NOK
"
return
reports
return
reports
def
pretty_json
(
j
):
return
json
.
dumps
(
j
,
sort_keys
=
True
,
indent
=
4
)
def
import_dep_info
(
file_path
,
endpoints_to_scan
):
with
open
(
file_path
)
as
f
:
data
=
json
.
load
(
f
)
endpoints
=
dict
()
for
key
in
data
[
'
outputs
'
].
keys
():
if
key
in
endpoints_to_scan
:
endpoint
=
str
(
data
[
'
outputs
'
][
key
])
prefix
,
url
=
endpoint
.
split
(
"
://
"
)
if
"
:
"
in
url
:
host
,
port
=
url
.
split
(
"
:
"
)
else
:
host
=
url
if
prefix
==
"
https
"
:
port
=
'
443
'
elif
prefix
==
'
http
'
:
port
=
'
80
'
else
:
raise
Exception
(
f
"
Impossible to parse the endpoint port. Endpoint:
{
endpoint
}
"
)
logging
.
info
(
f
"
Endpoint:
{
host
}
:
{
port
}
"
)
if
host
not
in
endpoints
:
endpoints
[
host
]
=
{
"
22
"
}
endpoints
[
host
].
add
(
port
)
for
host
,
ports
in
endpoints
.
items
():
endpoints
[
host
]
=
sorted
(
list
(
ports
))
return
endpoints
\ No newline at end of file
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