changing get_filtered_emails

pull/907/head
Adrian Maraj 2024-04-08 16:12:56 +02:00 committed by Raphaël Vinot
parent 65c855b95b
commit 16deaf18c7
1 changed files with 6 additions and 11 deletions

View File

@ -803,15 +803,10 @@ class Lookyloo():
def get_filtered_emails(self, capture_uuid, detailed=False) -> set[str] | dict[str, str]:
info = self.contacts(capture_uuid)
if detailed: #emails in a dict with their hostname as key
final_mails = {}
for i in info:
final_mails[i['hostname']] = i['all_emails']
else: #just all emails together
final_mails = set()
for i in info:
for mail in i['all_emails']:
final_mails.add(mail)
final_mails = set()
for i in info:
for mail in i['all_emails']:
final_mails.add(mail)
return final_mails
def contacts(self, capture_uuid: str, /) -> list[dict[str, Any]]:
@ -819,8 +814,8 @@ class Lookyloo():
rendered_hostnode = self.get_hostnode_from_tree(capture_uuid, capture.root_hartree.rendered_node.hostnode_uuid)
result = []
for node in reversed(rendered_hostnode.get_ancestors()):
result.append(self.takedown_filtered(node))
result.append(self.takedown_filtered(rendered_hostnode))
result.append(self.takedown_details(node))
result.append(self.takedown_details(rendered_hostnode))
return result
def send_mail(self, capture_uuid: str, /, email: str='', comment: str | None=None) -> bool | dict[str, Any]: