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: ...@@ -284,9 +284,6 @@ class Task:
get_report_info = retrieves report information get_report_info = retrieves report information
""" """
# Configiration
COMMUNICATION_RETRIES = 3
def __init__(self, def __init__(self,
client, client,
name: str, name: str,
...@@ -405,29 +402,6 @@ class Task: ...@@ -405,29 +402,6 @@ class Task:
def __del__(self): def __del__(self):
self.delete() 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): def update_status(self):
task_info = self.client.get_tasks(filter_string = self.id) \ task_info = self.client.get_tasks(filter_string = self.id) \
.xpath('task')[0] .xpath('task')[0]
......
...@@ -128,15 +128,9 @@ for host,ports in endpoints.items(): ...@@ -128,15 +128,9 @@ for host,ports in endpoints.items():
else: else:
reports[host] = {'global': {"severity": -1, "threat": f"Scan Error. task.id: {task.id}"} } reports[host] = {'global': {"severity": -1, "threat": f"Scan Error. task.id: {task.id}"} }
for task in tasks:
for task in tasks: del task
gvm.get_client().delete_task(task.id) #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 target in targets: for target in targets:
try: try:
...@@ -149,7 +143,7 @@ for port_list in port_lists: ...@@ -149,7 +143,7 @@ for port_list in port_lists:
del port_list del port_list
except Exception as e: except Exception as e:
logging.error(f"Error during port list deletion. Msg: {e.msg}") logging.error(f"Error during port list deletion. Msg: {e.msg}")
"""
reports = process_global_reports_info(reports) reports = process_global_reports_info(reports)
logging.info(pretty_json(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