Fixed report to show display names instead of class names of exploiters where needed

This commit is contained in:
VakarisZ 2021-04-06 10:11:34 +03:00
parent de2581d323
commit 87cec0036d
2 changed files with 12 additions and 3 deletions

View File

@ -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]

View File

@ -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():