Migrated more hard coded telem category values to use enum

This commit is contained in:
VakarisZ 2020-09-03 12:38:40 +03:00
parent 3f725c1639
commit 7538f774ed
4 changed files with 13 additions and 10 deletions

View File

@ -7,3 +7,4 @@ class TelemCategoryEnum:
SYSTEM_INFO = 'system_info'
TRACE = 'trace'
TUNNEL = 'tunnel'
ATTACK = 'attack'

View File

@ -20,4 +20,4 @@ def run_scoutsuite(cloud_type):
def send_results(results):
ScoutSuiteTelem.send(results)
ScoutSuiteTelem(results).send(results)

View File

@ -1,3 +1,4 @@
from common.common_consts.telem_categories import TelemCategoryEnum
from infection_monkey.telemetry.base_telem import BaseTelem
__author__ = "VakarisZ"
@ -15,7 +16,7 @@ class AttackTelem(BaseTelem):
self.technique = technique
self.status = status
telem_category = 'attack'
telem_category = TelemCategoryEnum.ATTACK
def get_data(self):
return {

View File

@ -1,5 +1,6 @@
import logging
from common.common_consts.telem_categories import TelemCategoryEnum
from monkey_island.cc.services.telemetry.processing.exploit import \
process_exploit_telemetry
from monkey_island.cc.services.telemetry.processing.post_breach import \
@ -17,15 +18,15 @@ logger = logging.getLogger(__name__)
TELEMETRY_CATEGORY_TO_PROCESSING_FUNC = \
{
'tunnel': process_tunnel_telemetry,
'state': process_state_telemetry,
'exploit': process_exploit_telemetry,
'scan': process_scan_telemetry,
'system_info': process_system_info_telemetry,
'post_breach': process_post_breach_telemetry,
TelemCategoryEnum.TUNNEL: process_tunnel_telemetry,
TelemCategoryEnum.STATE: process_state_telemetry,
TelemCategoryEnum.EXPLOIT: process_exploit_telemetry,
TelemCategoryEnum.SCAN: process_scan_telemetry,
TelemCategoryEnum.SYSTEM_INFO: process_system_info_telemetry,
TelemCategoryEnum.POST_BREACH: process_post_breach_telemetry,
# `lambda *args, **kwargs: None` is a no-op.
'trace': lambda *args, **kwargs: None,
'attack': lambda *args, **kwargs: None,
TelemCategoryEnum.TRACE: lambda *args, **kwargs: None,
TelemCategoryEnum.ATTACK: lambda *args, **kwargs: None,
}