forked from p15670423/monkey
Small changes
This commit is contained in:
parent
d8adaef046
commit
e9dfd0bc54
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
@ -72,9 +72,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):
|
||||
|
@ -93,6 +94,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:
|
||||
|
@ -143,7 +145,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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue