From e6b3613db28e985789d68dc2ae066363622ba9cf Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 13 Jul 2020 19:20:38 +0530 Subject: [PATCH] Check status using mongo --- .../cc/services/attack/technique_reports/T1154.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/T1154.py b/monkey/monkey_island/cc/services/attack/technique_reports/T1154.py index 5a1d56503..9d95bb087 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/T1154.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/T1154.py @@ -26,11 +26,11 @@ class T1154(AttackTechnique): trap_command_info = list(mongo.db.telemetry.aggregate(T1154.query)) - status = [] - for pba_node in trap_command_info: - status.append(pba_node['result'][1]) - status = (ScanStatus.USED.value if any(status) else ScanStatus.SCANNED.value)\ - if status else ScanStatus.UNSCANNED.value + status = ScanStatus.UNSCANNED.value + if trap_command_info: + successful_PBAs = mongo.db.telemetry.count({'data.name': POST_BREACH_TRAP_COMMAND, + 'data.result.1': True}) + status = ScanStatus.USED.value if successful_PBAs else ScanStatus.SCANNED.value data.update(T1154.get_base_data_by_status(status)) data.update({'info': trap_command_info})