From 8c62a597e7148bf4db468b5e3e9b3193477daa8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 1 Jun 2021 16:06:24 -0700 Subject: [PATCH] fix: Make mypy happy --- lookyloo/modules.py | 8 +++++--- website/web/__init__.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lookyloo/modules.py b/lookyloo/modules.py index d8e53cc..3226472 100644 --- a/lookyloo/modules.py +++ b/lookyloo/modules.py @@ -58,7 +58,7 @@ class MISP(): def get_fav_tags(self): return self.client.tags(pythonify=True, favouritesOnly=1) - def _prepare_push(self, to_push: Union[List[MISPEvent], MISPEvent], allow_duplicates: bool=False, auto_publish: bool=False) -> Union[List[MISPEvent], Dict]: + def _prepare_push(self, to_push: Union[List[MISPEvent], MISPEvent], allow_duplicates: bool=False, auto_publish: Optional[bool]=False) -> Union[List[MISPEvent], Dict]: '''Adds the pre-configured information as required by the instance. If duplicates aren't allowed, they will be automatically skiped and the extends_uuid key in the next element in the list updated''' @@ -128,9 +128,11 @@ class MISP(): to_lookup += hostnode.cnames if attributes := self.client.search(controller='attributes', value=to_lookup, pythonify=True): if isinstance(attributes, list): - return list(set(attribute.event_id for attribute in attributes)) + # NOTE: We have MISPAttributes in that list + return list(set(attribute.event_id for attribute in attributes)) # type: ignore else: - return attributes + # The request returned an error + return attributes # type: ignore return [] else: return {'error': 'Module not available or lookup not enabled.'} diff --git a/website/web/__init__.py b/website/web/__init__.py index 9f8fc22..d625895 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -345,7 +345,7 @@ def web_misp_lookup_view(tree_uuid: str): if hits: misp_root_url = lookyloo.misp.client.root_url else: - misp_root_url = None + misp_root_url = '' return render_template('misp_lookup.html', uuid=tree_uuid, hits=hits, misp_root_url=misp_root_url)