mirror of https://github.com/CIRCL/lookyloo
Merge branch 'adrima01-3rd_party'
commit
4b6cf752bc
|
@ -371,15 +371,16 @@ class Lookyloo():
|
||||||
to_return['URLhaus'] = self.urlhaus.capture_default_trigger(cache, auto_trigger=auto_trigger)
|
to_return['URLhaus'] = self.urlhaus.capture_default_trigger(cache, auto_trigger=auto_trigger)
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
def get_modules_responses(self, capture_uuid: str, /) -> dict[str, Any] | None:
|
def get_modules_responses(self, capture_uuid: str, /) -> dict[str, Any]:
|
||||||
'''Get the responses of the modules from the cached responses on the disk'''
|
'''Get the responses of the modules from the cached responses on the disk'''
|
||||||
cache = self.capture_cache(capture_uuid)
|
cache = self.capture_cache(capture_uuid)
|
||||||
|
# TODO: return a message when we cannot get the modules responses, update the code checking if it is falsy accordingly.
|
||||||
if not cache:
|
if not cache:
|
||||||
self.logger.warning(f'Unable to get the modules responses unless the capture {capture_uuid} is cached')
|
self.logger.warning(f'Unable to get the modules responses unless the capture {capture_uuid} is cached')
|
||||||
return None
|
return {}
|
||||||
if not hasattr(cache, 'url'):
|
if not hasattr(cache, 'url'):
|
||||||
self.logger.warning(f'The capture {capture_uuid} does not have a URL in the cache, it is broken.')
|
self.logger.warning(f'The capture {capture_uuid} does not have a URL in the cache, it is broken.')
|
||||||
return None
|
return {}
|
||||||
|
|
||||||
to_return: dict[str, Any] = {}
|
to_return: dict[str, Any] = {}
|
||||||
if self.vt.available:
|
if self.vt.available:
|
||||||
|
|
|
@ -282,6 +282,14 @@ class TriggerModules(Resource): # type: ignore[misc]
|
||||||
return lookyloo.trigger_modules(capture_uuid, force=force)
|
return lookyloo.trigger_modules(capture_uuid, force=force)
|
||||||
|
|
||||||
|
|
||||||
|
@api.route('/json/<string:tree_uuid>/modules')
|
||||||
|
@api.doc(description='Get responses from the 3rd party modules',
|
||||||
|
params={'tree_uuid': 'The UUID of the capture'})
|
||||||
|
class ModulesResponse(Resource): # type: ignore[misc]
|
||||||
|
def get(self, tree_uuid: str) -> dict[str, Any]:
|
||||||
|
return lookyloo.get_modules_responses(tree_uuid)
|
||||||
|
|
||||||
|
|
||||||
@api.route('/json/hash_info/<h>')
|
@api.route('/json/hash_info/<h>')
|
||||||
@api.doc(description='Search for a ressource with a specific hash (sha512)',
|
@api.doc(description='Search for a ressource with a specific hash (sha512)',
|
||||||
params={'h': 'The hash (sha512)'})
|
params={'h': 'The hash (sha512)'})
|
||||||
|
|
Loading…
Reference in New Issue