Skip to content
Snippets Groups Projects
Commit cfd27bcf authored by Gioacchino Vino's avatar Gioacchino Vino
Browse files

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!91Changed module names
...@@ -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()
......
...@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment