From 79d042b47112b6843520b0223b4a5c6a8ec3309b Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 8 Jul 2021 15:44:43 +0530 Subject: [PATCH] island: Create RansomwareReportService and add `get_exploitation_stats()` to it --- .../monkey_island/cc/resources/ransomware_report.py | 3 ++- .../monkey_island/cc/services/ransomware_report.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 monkey/monkey_island/cc/services/ransomware_report.py diff --git a/monkey/monkey_island/cc/resources/ransomware_report.py b/monkey/monkey_island/cc/resources/ransomware_report.py index 55da76b06..f0232e72e 100644 --- a/monkey/monkey_island/cc/resources/ransomware_report.py +++ b/monkey/monkey_island/cc/resources/ransomware_report.py @@ -2,9 +2,10 @@ import flask_restful from flask import jsonify from monkey_island.cc.resources.auth.auth import jwt_required +from monkey_island.cc.services.ransomware_report import RansomwareReportService class RansomwareReport(flask_restful.Resource): @jwt_required def get(self): - return jsonify({"report": None}) + return jsonify({"report": None, "stats": RansomwareReportService.get_exploitation_stats()}) diff --git a/monkey/monkey_island/cc/services/ransomware_report.py b/monkey/monkey_island/cc/services/ransomware_report.py new file mode 100644 index 000000000..93def94d7 --- /dev/null +++ b/monkey/monkey_island/cc/services/ransomware_report.py @@ -0,0 +1,13 @@ +from monkey_island.cc.services.reporting.report import ReportService + + +class RansomwareReportService: + def __init__(self): + pass + + @staticmethod + def get_exploitation_stats(): + scanned = ReportService.get_scanned() + exploited = ReportService.get_exploited() + + return {"scanned": scanned, "exploited": exploited}