From 7b167ba0c43ce8890200659933b1ce19d97439b9 Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 5 Jul 2021 16:17:40 +0530 Subject: [PATCH 1/3] island: Add API endpoint for ransomware report --- monkey/monkey_island/cc/app.py | 2 ++ monkey/monkey_island/cc/resources/ransomware_report.py | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 monkey/monkey_island/cc/resources/ransomware_report.py diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index ecc5feca1..8800d382a 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -38,6 +38,7 @@ from monkey_island.cc.resources.node import Node from monkey_island.cc.resources.node_states import NodeStates from monkey_island.cc.resources.pba_file_download import PBAFileDownload from monkey_island.cc.resources.pba_file_upload import FileUpload +from monkey_island.cc.resources.ransomware_report import RansomwareReport from monkey_island.cc.resources.remote_run import RemoteRun from monkey_island.cc.resources.root import Root from monkey_island.cc.resources.security_report import SecurityReport @@ -149,6 +150,7 @@ def init_api_resources(api): api.add_resource(SecurityReport, "/api/report/security") api.add_resource(ZeroTrustReport, "/api/report/zero-trust/") api.add_resource(AttackReport, "/api/report/attack") + api.add_resource(RansomwareReport, "/api/report/ransomware") api.add_resource(ZeroTrustFindingEvent, "/api/zero-trust/finding-event/") api.add_resource(TelemetryFeed, "/api/telemetry-feed", "/api/telemetry-feed/") diff --git a/monkey/monkey_island/cc/resources/ransomware_report.py b/monkey/monkey_island/cc/resources/ransomware_report.py new file mode 100644 index 000000000..a2edaf612 --- /dev/null +++ b/monkey/monkey_island/cc/resources/ransomware_report.py @@ -0,0 +1,10 @@ +import flask_restful +from flask import jsonify + +from monkey_island.cc.resources.auth.auth import jwt_required + + +class RansomwareReport(flask_restful.Resource): + @jwt_required + def get(self): + return jsonify({"show": True, "report": None}) From 6d32f851202a8bc077c64ab685203df07837448f Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 6 Jul 2021 16:14:22 +0530 Subject: [PATCH 2/3] island: Remove responsibility to decide whether the report should be displayed, from the backend --- monkey/monkey_island/cc/resources/ransomware_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/resources/ransomware_report.py b/monkey/monkey_island/cc/resources/ransomware_report.py index a2edaf612..55da76b06 100644 --- a/monkey/monkey_island/cc/resources/ransomware_report.py +++ b/monkey/monkey_island/cc/resources/ransomware_report.py @@ -7,4 +7,4 @@ from monkey_island.cc.resources.auth.auth import jwt_required class RansomwareReport(flask_restful.Resource): @jwt_required def get(self): - return jsonify({"show": True, "report": None}) + return jsonify({"report": None}) From c78c955551af534636750d8befb90f150b6fc4d4 Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 6 Jul 2021 16:16:35 +0530 Subject: [PATCH 3/3] CHANGELOG: Add ransomware report API endpoint --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ca3838f6..0cda649b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Scripts to build an AppImage for Monkey Island. #1069, #1090, #1136 - `log_level` option to server config. #1151 - A ransomware simulation payload. #1238 +- API endpoint for ransomware report. #1297 ### Changed - server_config.json can be selected at runtime. #963