diff --git a/files/gvm_library.py b/files/gvm_library.py index 0920834e781c03b623e4eecb2c1fda67b4b72f39..8e6b81c7ba00615686aa4116badc56a817563ea1 100644 --- a/files/gvm_library.py +++ b/files/gvm_library.py @@ -284,9 +284,6 @@ class Task: get_report_info = retrieves report information """ - # Configiration - COMMUNICATION_RETRIES = 3 - def __init__(self, client, name: str, @@ -405,29 +402,6 @@ class Task: def __del__(self): self.delete() - def qwe__get_info(self, filter: str) -> List[dict]: - res = [] - tasks = self.client.get_tasks(filter_string = filter) \ - .xpath('task') - for t in tasks: - t_name = str(t.xpath(GVM_XPATH_NAME_TEXT)[0]) - t_id = str(t.xpath(GVM_XPATH_ID)[0]) - t_in_use = str(t.xpath(GVM_XPATH_INUSE_TEXT)[0]) - t_status = str(t.xpath(GVM_XPATH_STATUS_TEXT_3)[0]) - t_dict = {"name": t_name, - "id": t_id, - "in_use": t_in_use, - "status": t_status} - try: - t_report_id = t.xpath(GVM_XPATH_LAST_REPORT_ID)[0] - except Exception: - pass - else: - t_dict['report_id'] = t_report_id - - res.append(t_dict) - return res - def update_status(self): task_info = self.client.get_tasks(filter_string = self.id) \ .xpath('task')[0] diff --git a/files/scan.py b/files/scan.py index 2dfb730cfc9149ece17b8579c1d723ead11cc74b..8e2f10ce2d7004c6e1b735abb38e0b8248189b96 100644 --- a/files/scan.py +++ b/files/scan.py @@ -128,15 +128,9 @@ for host,ports in endpoints.items(): else: reports[host] = {'global': {"severity": -1, "threat": f"Scan Error. task.id: {task.id}"} } - - for task in tasks: - gvm.get_client().delete_task(task.id) - -"""for task in tasks: - try: - del task - except Exception as e: - logging.error(f"Error during task deletion. Msg: {e.msg}") +for task in tasks: + del task + #gvm.get_client().delete_task(task.id) for target in targets: try: @@ -149,7 +143,7 @@ for port_list in port_lists: del port_list except Exception as e: logging.error(f"Error during port list deletion. Msg: {e.msg}") -""" + reports = process_global_reports_info(reports) logging.info(pretty_json(reports))