From ce5921eaad0202c31c890eced448d951a7a73a7d Mon Sep 17 00:00:00 2001 From: Shreya Date: Tue, 14 Jul 2020 17:42:49 +0530 Subject: [PATCH] Add fn to check if disabled in config --- .../cc/services/attack/technique_reports/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 1a8e79a79..3930b07dd 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/__init__.py @@ -62,7 +62,7 @@ class AttackTechnique(object, metaclass=abc.ABCMeta): Gets the status of a certain attack technique. :return: ScanStatus numeric value """ - if not cls._is_enabled_in_config(): + if cls._is_disabled_in_config(): return ScanStatus.DISABLED.value elif mongo.db.telemetry.find_one({'telem_category': 'attack', 'data.status': ScanStatus.USED.value, @@ -72,8 +72,6 @@ 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.UNSCANNED.value @@ -145,6 +143,10 @@ class AttackTechnique(object, metaclass=abc.ABCMeta): @classmethod def _check_status(cls, status): - if status == ScanStatus.UNSCANNED.value and not AttackConfig.get_technique_values()[cls.tech_id]: + if status == ScanStatus.UNSCANNED.value and cls._is_disabled_in_config(): return ScanStatus.DISABLED.value return status + + @classmethod + def _is_disabled_in_config(cls): + return not AttackConfig.get_technique_values()[cls.tech_id]