forked from p15670423/monkey
Small changes
This commit is contained in:
parent
fa7cff755f
commit
c77467079b
|
@ -3,6 +3,7 @@ from common.data.post_breach_consts import (
|
||||||
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
from monkey_island.cc.services.attack.technique_reports.pba_technique import \
|
||||||
PostBreachTechnique
|
PostBreachTechnique
|
||||||
|
|
||||||
|
|
||||||
__author__ = "shreyamalviya"
|
__author__ = "shreyamalviya"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,10 @@ class AttackTechnique(object, metaclass=abc.ABCMeta):
|
||||||
'data.status': ScanStatus.SCANNED.value,
|
'data.status': ScanStatus.SCANNED.value,
|
||||||
'data.technique': cls.tech_id}):
|
'data.technique': cls.tech_id}):
|
||||||
return ScanStatus.SCANNED.value
|
return ScanStatus.SCANNED.value
|
||||||
|
elif not AttackConfig.get_technique_values()[cls.tech_id]:
|
||||||
|
return ScanStatus.DISABLED.value
|
||||||
else:
|
else:
|
||||||
return ScanStatus.DISABLED.value if not AttackConfig.get_technique_values()[cls.tech_id]\
|
return ScanStatus.UNSCANNED.value
|
||||||
else ScanStatus.UNSCANNED.value
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_message_and_status(cls, status):
|
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
|
:param status: Enum from common/attack_utils.py integer value
|
||||||
:return: message string
|
:return: message string
|
||||||
"""
|
"""
|
||||||
|
status = cls._check_status(status)
|
||||||
if status == ScanStatus.DISABLED.value:
|
if status == ScanStatus.DISABLED.value:
|
||||||
return disabled_msg
|
return disabled_msg
|
||||||
if status == ScanStatus.UNSCANNED.value:
|
if status == ScanStatus.UNSCANNED.value:
|
||||||
|
@ -141,7 +143,6 @@ class AttackTechnique(object, metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _check_status(cls, status):
|
def _check_status(cls, status):
|
||||||
if status == ScanStatus.UNSCANNED.value:
|
if status == ScanStatus.UNSCANNED.value and not AttackConfig.get_technique_values()[cls.tech_id]:
|
||||||
return ScanStatus.DISABLED.value if not AttackConfig.get_technique_values()[cls.tech_id]\
|
return ScanStatus.DISABLED.value
|
||||||
else ScanStatus.UNSCANNED.value
|
|
||||||
return status
|
return status
|
||||||
|
|
|
@ -18,7 +18,6 @@ class PostBreachTechnique(AttackTechnique, metaclass=abc.ABCMeta):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_pba_query(cls, post_breach_action_names):
|
def get_pba_query(cls, post_breach_action_names):
|
||||||
return [{'$match': {'telem_category': 'post_breach',
|
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]}},
|
'$or': [{'data.name': pba_name} for pba_name in post_breach_action_names]}},
|
||||||
{'$project': {'_id': 0,
|
{'$project': {'_id': 0,
|
||||||
'machine': {'hostname': '$data.hostname',
|
'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)\
|
status = (ScanStatus.USED.value if any(status) else ScanStatus.SCANNED.value)\
|
||||||
if status else ScanStatus.UNSCANNED.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(cls.get_base_data_by_status(status))
|
||||||
data.update({'info': info})
|
data.update({'info': info})
|
||||||
return data
|
return data
|
||||||
|
|
Loading…
Reference in New Issue