From dae544dece35143f73a423534e89ad8462cd5cc1 Mon Sep 17 00:00:00 2001 From: qweqweasdasd <qweqweasdasd@infn.it> Date: Thu, 13 Oct 2022 13:29:36 +0200 Subject: [PATCH] Fixed endpoint port missing --- utils/script.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/utils/script.py b/utils/script.py index 2ac254f..737c9fb 100644 --- a/utils/script.py +++ b/utils/script.py @@ -385,9 +385,19 @@ def import_dep_info(file_path, endpoints_to_scan): endpoints = dict() for key in data['outputs'].keys(): if key in endpoints_to_scan: - endpoint = str(data['outputs'][key]).split("/")[2] - print("endpoint",endpoint) - host,port = endpoint.split(':') + 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}") + print(f"Endpoint: {host}:{port}") if host not in endpoints: endpoints[host] = {"22"} endpoints[host].add(port) -- GitLab