mirror of https://github.com/CIRCL/lookyloo
fix: Make mypy happy
parent
9f88edd74d
commit
a8711a18f1
|
@ -17,7 +17,7 @@ import vt # type: ignore
|
|||
from vt.error import APIError # type: ignore
|
||||
from pysanejs import SaneJS
|
||||
from pyeupi import PyEUPI
|
||||
from pymisp import PyMISP, MISPEvent
|
||||
from pymisp import PyMISP, MISPEvent, MISPAttribute
|
||||
|
||||
|
||||
class MISP():
|
||||
|
@ -65,7 +65,7 @@ class MISP():
|
|||
|
||||
def get_existing_event(self, permaurl: str) -> Optional[str]:
|
||||
attributes = self.client.search('attributes', value=permaurl, limit=1, page=1, pythonify=True)
|
||||
if not attributes:
|
||||
if not attributes or not isinstance(attributes[0], MISPAttribute):
|
||||
return None
|
||||
url = f'{self.client.root_url}/events/{attributes[0].event_id}'
|
||||
return url
|
||||
|
|
|
@ -886,6 +886,8 @@ def web_misp_push_view(tree_uuid: str):
|
|||
if error:
|
||||
return redirect(url_for('tree', tree_uuid=tree_uuid))
|
||||
|
||||
# After this point, event is a MISPEvent
|
||||
|
||||
if request.method == 'POST':
|
||||
# event is a MISPEvent at this point
|
||||
# Submit the event
|
||||
|
@ -900,7 +902,7 @@ def web_misp_push_view(tree_uuid: str):
|
|||
return redirect(url_for('tree', tree_uuid=tree_uuid))
|
||||
else:
|
||||
# the 1st attribute in the event is the link to lookyloo
|
||||
existing_misp_url = lookyloo.misp.get_existing_event(event.attributes[0].value)
|
||||
existing_misp_url = lookyloo.misp.get_existing_event(event.attributes[0].value) # type: ignore
|
||||
|
||||
fav_tags = lookyloo.misp.get_fav_tags()
|
||||
|
||||
|
|
Loading…
Reference in New Issue