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