From 7b32454f9aa615a008575618c27b9738f39f3ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 15 Jun 2021 18:26:41 -0700 Subject: [PATCH] new: get all the ressources hashes in API --- website/web/genericapi.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/website/web/genericapi.py b/website/web/genericapi.py index 6232020f..e31fe5f4 100644 --- a/website/web/genericapi.py +++ b/website/web/genericapi.py @@ -65,6 +65,18 @@ class CaptureStatusQuery(Resource): return {'status_code': lookyloo.get_capture_status(capture_uuid)} +@api.route('/json//hashes') +@api.doc(description='Get all the hashes of all the resources of a capture', + params={'capture_uuid': 'The UUID of the capture'}) +class CaptureHashes(Resource): + def get(self, capture_uuid: str): + cache = lookyloo.capture_cache(capture_uuid) + if not cache: + return {'error': 'UUID missing in cache, try again later.'} + to_return: Dict[str, Any] = {'response': {'hashes': list(lookyloo.get_hashes(capture_uuid))}} + return to_return + + @api.route('/json//redirects') @api.doc(description='Get all the redirects of a capture', params={'capture_uuid': 'The UUID of the capture'})