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

Reviewed code

parent 4ce44a3f
No related branches found
No related tags found
1 merge request!143Debug paas ci
......@@ -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]
......
......@@ -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))
......
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