From 38bead54ae5fde912a32ff99ef1f8f4e2050d073 Mon Sep 17 00:00:00 2001 From: Shreya Date: Thu, 8 Jul 2021 19:53:52 +0530 Subject: [PATCH] island: Extract methods (all static) in class RansomwareReportService and remove the class --- monkey/monkey_island/cc/resources/ransomware_report.py | 6 ++---- monkey/monkey_island/cc/services/ransomware_report.py | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/monkey/monkey_island/cc/resources/ransomware_report.py b/monkey/monkey_island/cc/resources/ransomware_report.py index 96abfe252..d13a216e9 100644 --- a/monkey/monkey_island/cc/resources/ransomware_report.py +++ b/monkey/monkey_island/cc/resources/ransomware_report.py @@ -2,12 +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 +from monkey_island.cc.services.ransomware_report import get_exploitation_details class RansomwareReport(flask_restful.Resource): @jwt_required def get(self): - return jsonify( - {"report": None, "stats": RansomwareReportService.get_exploitation_details()} - ) + return jsonify({"report": None, "stats": get_exploitation_details()}) diff --git a/monkey/monkey_island/cc/services/ransomware_report.py b/monkey/monkey_island/cc/services/ransomware_report.py index 23fb8cec4..74d30cf93 100644 --- a/monkey/monkey_island/cc/services/ransomware_report.py +++ b/monkey/monkey_island/cc/services/ransomware_report.py @@ -1,10 +1,8 @@ from monkey_island.cc.services.reporting.report import ReportService -class RansomwareReportService: - @staticmethod - def get_exploitation_details(): - scanned = ReportService.get_scanned() - exploited = ReportService.get_exploited() +def get_exploitation_details(): + scanned = ReportService.get_scanned() + exploited = ReportService.get_exploited() - return {"scanned": scanned, "exploited": exploited} + return {"scanned": scanned, "exploited": exploited}