From 9e7e58658c8cfcf2afc8d25240d885a6d198db56 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 12 Jul 2021 11:54:39 -0400 Subject: [PATCH] Island: Simplify _get_exploit_counts() --- monkey/monkey_island/cc/services/ransomware_report.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/monkey/monkey_island/cc/services/ransomware_report.py b/monkey/monkey_island/cc/services/ransomware_report.py index 65098daec..0e0f1c299 100644 --- a/monkey/monkey_island/cc/services/ransomware_report.py +++ b/monkey/monkey_island/cc/services/ransomware_report.py @@ -18,11 +18,7 @@ def _get_exploit_counts(exploited: List[Dict]) -> Dict: exploit_counts = {} for node in exploited: - exploits = node["exploits"] - for exploit in exploits: - if exploit in exploit_counts: - exploit_counts[exploit] += 1 - else: - exploit_counts[exploit] = 1 + for exploit in node["exploits"]: + exploit_counts[exploit] = exploit_counts.get(exploit, 0) + 1 return exploit_counts