From 60b475fbae0f5e58ea50afcd23131e20d06197fe Mon Sep 17 00:00:00 2001 From: Jeroen Gui Date: Fri, 26 Jul 2024 10:50:39 +0200 Subject: [PATCH] add new endpoint to remove capture --- website/web/genericapi.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/web/genericapi.py b/website/web/genericapi.py index e4c25dd..7d8a5e3 100644 --- a/website/web/genericapi.py +++ b/website/web/genericapi.py @@ -784,6 +784,21 @@ class CaptureHide(Resource): # type: ignore[misc] except Exception as e: return {'error': f'Unable to hide the tree: {e}'}, 400 return {'info': f'Capture {capture_uuid} successfully hidden.'} + + +@api.route('/admin//remove') +@api.doc(description='Remove the capture from the index.', + params={'capture_uuid': 'The UUID of the capture'}, + security='apikey') +class CaptureRemove(Resource): # type: ignore[misc] + method_decorators = [api_auth_check] + + def post(self, capture_uuid: str) -> dict[str, str] | tuple[dict[str, str], int]: + try: + lookyloo.remove_capture(capture_uuid) + except Exception as e: + return {'error': f'Unable to remove the tree: {e}'}, 400 + return {'info': f'Capture {capture_uuid} successfully removed.'} @api.route('/json/recent_captures')