From a8a355afb29c8638ed7a479808abeb21d8577b0b Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 26 Jun 2019 17:32:31 +0300 Subject: [PATCH] Updated private keys attack technique --- monkey/monkey_island/cc/services/attack/attack_report.py | 1 - .../cc/services/attack/technique_reports/T1110.py | 4 ++-- .../cc/services/attack/technique_reports/T1145.py | 8 ++++---- .../cc/services/attack/technique_reports/__init__.py | 8 ++++---- .../cc/ui/src/components/attack/techniques/Helpers.js | 2 ++ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/monkey/monkey_island/cc/services/attack/attack_report.py b/monkey/monkey_island/cc/services/attack/attack_report.py index 3efe0007f..7bec85a32 100644 --- a/monkey/monkey_island/cc/services/attack/attack_report.py +++ b/monkey/monkey_island/cc/services/attack/attack_report.py @@ -1,7 +1,6 @@ import logging from monkey_island.cc.services.attack.technique_reports import T1210, T1197, T1110, T1075, T1003, T1059, T1086, T1082 from monkey_island.cc.services.attack.technique_reports import T1145 -from monkey_island.cc.services.attack.attack_telem import AttackTelemService from monkey_island.cc.services.attack.attack_config import AttackConfig from monkey_island.cc.database import mongo diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/T1110.py b/monkey/monkey_island/cc/services/attack/technique_reports/T1110.py index 60ae14c0b..91d785bc3 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/T1110.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/T1110.py @@ -40,11 +40,11 @@ class T1110(AttackTechnique): status = ScanStatus.SCANNED else: status = ScanStatus.UNSCANNED - data = T1110.get_message_and_status(status) + data = T1110.get_base_data_by_status(status) # Remove data with no successful brute force attempts attempts = [attempt for attempt in attempts if attempt['attempts']] - data.update({'services': attempts, 'title': T1110.technique_title()}) + data.update({'services': attempts}) return data @staticmethod diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/T1145.py b/monkey/monkey_island/cc/services/attack/technique_reports/T1145.py index 29b4e97c0..9b525873f 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/T1145.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/T1145.py @@ -12,7 +12,7 @@ class T1145(AttackTechnique): used_msg = "Monkey found ssh keys on machines in the network." # Gets data about ssh keys found - query = [{'$match': {'telem_type': 'system_info_collection', + query = [{'$match': {'telem_category': 'system_info_collection', 'data.ssh_info': {'$elemMatch': {'private_key': {'$exists': True}}}}}, {'$project': {'_id': 0, 'machine': {'hostname': '$data.hostname', 'ips': '$data.network_info.networks'}, @@ -23,9 +23,9 @@ class T1145(AttackTechnique): ssh_info = list(mongo.db.telemetry.aggregate(T1145.query)) if ssh_info: - data = T1145.get_base_data_by_status(T1145, ScanStatus.USED) + status = ScanStatus.USED else: - data = T1145.get_base_data_by_status(T1145, ScanStatus.UNSCANNED) - + status = ScanStatus.UNSCANNED + data = T1145.get_base_data_by_status(status) data.update({'ssh_info': ssh_info}) return data diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py index 95483e790..edd180d50 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py @@ -107,8 +107,8 @@ class AttackTechnique(object): 'message': cls.get_message_by_status(status)}) return data - @staticmethod - def get_base_data_by_status(technique, status): - data = technique.get_message_and_status(technique, status) - data.update({'title': technique.technique_title(technique.tech_id)}) + @classmethod + def get_base_data_by_status(cls, status): + data = cls.get_message_and_status(status) + data.update({'title': cls.technique_title()}) return data diff --git a/monkey/monkey_island/cc/ui/src/components/attack/techniques/Helpers.js b/monkey/monkey_island/cc/ui/src/components/attack/techniques/Helpers.js index 9d2fdfa62..9885219ad 100644 --- a/monkey/monkey_island/cc/ui/src/components/attack/techniques/Helpers.js +++ b/monkey/monkey_island/cc/ui/src/components/attack/techniques/Helpers.js @@ -6,6 +6,8 @@ export function renderMachine(val){ ) } +/* Function takes data gathered from system info collector and creates a + string representation of machine from that data. */ export function renderMachineFromSystemData(data) { let machineStr = data['hostname'] + " ( "; data['ips'].forEach(function(ipInfo){