From 87cec0036de69c1ee757529f30ebec5eeb6b4aca Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 6 Apr 2021 10:11:34 +0300 Subject: [PATCH] Fixed report to show display names instead of class names of exploiters where needed --- .../exploit_processing/exploiter_descriptor_enum.py | 8 +++++++- monkey/monkey_island/cc/services/reporting/report.py | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/services/reporting/issue_processing/exploit_processing/exploiter_descriptor_enum.py b/monkey/monkey_island/cc/services/reporting/issue_processing/exploit_processing/exploiter_descriptor_enum.py index 6378c77db..08c471174 100644 --- a/monkey/monkey_island/cc/services/reporting/issue_processing/exploit_processing/exploiter_descriptor_enum.py +++ b/monkey/monkey_island/cc/services/reporting/issue_processing/exploit_processing/exploiter_descriptor_enum.py @@ -33,7 +33,7 @@ class ExploiterDescriptorEnum(Enum): MSSQL = ExploiterDescriptor('MSSQLExploiter', 'MSSQL Exploiter', ExploitProcessor) VSFTPD = ExploiterDescriptor('VSFTPDExploiter', 'VSFTPD Backdoor Exploiter', CredExploitProcessor) DRUPAL = ExploiterDescriptor('DrupalExploiter', 'Drupal Server Exploiter', ExploitProcessor) - ZEROLOGON = ExploiterDescriptor('ZerologonExploiter', 'ZeroLogon Exploiter', ZerologonExploitProcessor) + ZEROLOGON = ExploiterDescriptor('ZerologonExploiter', 'Zerologon Exploiter', ZerologonExploitProcessor) @staticmethod def __dict__() -> Dict[str, ExploiterDescriptor]: @@ -41,3 +41,9 @@ class ExploiterDescriptorEnum(Enum): for descriptor in ExploiterDescriptorEnum: descriptor_dict[descriptor.value.class_name] = descriptor return descriptor_dict + + @staticmethod + def get_display_name_by_class_name(class_name: str) -> str: + return [descriptor.display_name.value + for descriptor in ExploiterDescriptorEnum + if descriptor.class_name.value == class_name][0] diff --git a/monkey/monkey_island/cc/services/reporting/report.py b/monkey/monkey_island/cc/services/reporting/report.py index a70634f07..d84c5ad94 100644 --- a/monkey/monkey_island/cc/services/reporting/report.py +++ b/monkey/monkey_island/cc/services/reporting/report.py @@ -145,7 +145,9 @@ class ReportService: @staticmethod def get_exploits_used_on_node(node: dict) -> List[str]: - return list(set([exploit['exploiter'] for exploit in node['exploits'] if exploit['result']])) + return list(set([ExploiterDescriptorEnum.get_display_name_by_class_name(exploit['exploiter']) + for exploit in node['exploits'] + if exploit['result']])) @staticmethod def get_stolen_creds(): @@ -483,7 +485,8 @@ class ReportService: if exploits == default_exploits: return ['default'] - return exploits + return [ExploiterDescriptorEnum.get_display_name_by_class_name(exploit) + for exploit in exploits] @staticmethod def get_config_ips():