mirror of https://github.com/CIRCL/lookyloo
chg: Fix typing
parent
8eab287721
commit
fbbfa3082d
|
@ -880,7 +880,7 @@ class Lookyloo():
|
|||
return 'embedded_ressource.bin', blob
|
||||
return None
|
||||
|
||||
def misp_export(self, capture_uuid: str) -> MISPEvent:
|
||||
def misp_export(self, capture_uuid: str) -> Union[MISPEvent, Dict[str, str]]:
|
||||
cache = self.capture_cache(capture_uuid)
|
||||
if not cache:
|
||||
return {'error': 'UUID missing in cache, try again later.'}
|
||||
|
@ -891,8 +891,8 @@ class Lookyloo():
|
|||
event = MISPEvent()
|
||||
event.info = f'Lookyloo Capture ({cache["url"]})'
|
||||
event.add_attribute('link', f'https://{self.public_domain}/tree/{capture_uuid}')
|
||||
initial_url = URLObject(cache["url"])
|
||||
redirects = [URLObject(url) for url in cache['redirects']]
|
||||
initial_url = URLObject(cache["url"]) # type: ignore
|
||||
redirects = [URLObject(url) for url in cache['redirects']] # type: ignore
|
||||
initial_url.add_reference(redirects[0], 'redirects-to')
|
||||
prec_object = redirects[0]
|
||||
for u_object in redirects[1:]:
|
||||
|
|
|
@ -673,6 +673,8 @@ def json_redirects(tree_uuid: str):
|
|||
@app.route('/json/<string:tree_uuid>/misp_export', methods=['GET'])
|
||||
def misp_export(tree_uuid: str):
|
||||
event = lookyloo.misp_export(tree_uuid)
|
||||
if isinstance(event, dict):
|
||||
return jsonify(event)
|
||||
return Response(event.to_json(indent=2), mimetype='application/json')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue