diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/T1136.py b/monkey/monkey_island/cc/services/attack/technique_reports/T1136.py index 086a1c139..2022aa3be 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/T1136.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/T1136.py @@ -3,6 +3,7 @@ from common.data.post_breach_consts import ( from monkey_island.cc.services.attack.technique_reports.pba_technique import \ PostBreachTechnique + __author__ = "shreyamalviya" 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 b93e15997..e237dd5e2 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py @@ -70,9 +70,10 @@ class AttackTechnique(object, metaclass=abc.ABCMeta): 'data.status': ScanStatus.SCANNED.value, 'data.technique': cls.tech_id}): return ScanStatus.SCANNED.value + elif not AttackConfig.get_technique_values()[cls.tech_id]: + return ScanStatus.DISABLED.value else: - return ScanStatus.DISABLED.value if not AttackConfig.get_technique_values()[cls.tech_id]\ - else ScanStatus.UNSCANNED.value + return ScanStatus.UNSCANNED.value @classmethod def get_message_and_status(cls, status): @@ -91,6 +92,7 @@ class AttackTechnique(object, metaclass=abc.ABCMeta): :param status: Enum from common/attack_utils.py integer value :return: message string """ + status = cls._check_status(status) if status == ScanStatus.DISABLED.value: return disabled_msg if status == ScanStatus.UNSCANNED.value: @@ -141,7 +143,6 @@ class AttackTechnique(object, metaclass=abc.ABCMeta): @classmethod def _check_status(cls, status): - if status == ScanStatus.UNSCANNED.value: - return ScanStatus.DISABLED.value if not AttackConfig.get_technique_values()[cls.tech_id]\ - else ScanStatus.UNSCANNED.value + if status == ScanStatus.UNSCANNED.value and not AttackConfig.get_technique_values()[cls.tech_id]: + return ScanStatus.DISABLED.value return status diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/pba_technique.py b/monkey/monkey_island/cc/services/attack/technique_reports/pba_technique.py index c588bb3c9..ef34eb417 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/pba_technique.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/pba_technique.py @@ -18,7 +18,6 @@ class PostBreachTechnique(AttackTechnique, metaclass=abc.ABCMeta): @classmethod def get_pba_query(cls, post_breach_action_names): return [{'$match': {'telem_category': 'post_breach', - # 'data.name': post_breach_action_name}}, '$or': [{'data.name': pba_name} for pba_name in post_breach_action_names]}}, {'$project': {'_id': 0, 'machine': {'hostname': '$data.hostname', @@ -37,10 +36,6 @@ class PostBreachTechnique(AttackTechnique, metaclass=abc.ABCMeta): status = (ScanStatus.USED.value if any(status) else ScanStatus.SCANNED.value)\ if status else ScanStatus.UNSCANNED.value - if status == ScanStatus.UNSCANNED.value and\ - not AttackConfig.get_technique_values()[cls.tech_id]: - status = ScanStatus.DISABLED.value - data.update(cls.get_base_data_by_status(status)) data.update({'info': info}) return data