diff --git a/monkey/infection_monkey/telemetry/attack/attack_telem.py b/monkey/infection_monkey/telemetry/attack/attack_telem.py index 6dc6a4ca9..ab11adecc 100644 --- a/monkey/infection_monkey/telemetry/attack/attack_telem.py +++ b/monkey/infection_monkey/telemetry/attack/attack_telem.py @@ -1,11 +1,7 @@ -import logging - from infection_monkey.telemetry.base_telem import BaseTelem __author__ = "VakarisZ" -LOG = logging.getLogger(__name__) - class AttackTelem(BaseTelem): diff --git a/monkey/infection_monkey/telemetry/attack/test_victimHostTelem.py b/monkey/infection_monkey/telemetry/attack/test_victimHostTelem.py new file mode 100644 index 000000000..0feb33b75 --- /dev/null +++ b/monkey/infection_monkey/telemetry/attack/test_victimHostTelem.py @@ -0,0 +1,20 @@ +from unittest import TestCase + +from common.utils.attack_utils import ScanStatus +from infection_monkey.model import VictimHost +from infection_monkey.telemetry.attack.victim_host_telem import VictimHostTelem + + +class TestVictimHostTelem(TestCase): + def test_get_data(self): + machine = VictimHost('127.0.0.1') + status = ScanStatus.USED + technique = 'T1210' + + telem = VictimHostTelem(technique, status, machine) + + self.assertEqual(telem.technique, technique) + self.assertEqual(telem.status, status) + self.assertEqual(telem.telem_type, 'attack') + self.assertEqual(telem.machine['domain_name'], machine.domain_name) + self.assertEqual(telem.machine['ip_addr'], machine.ip_addr) diff --git a/monkey/infection_monkey/telemetry/attack/victim_host_telem.py b/monkey/infection_monkey/telemetry/attack/victim_host_telem.py index 3fbbeb3a1..9e277926c 100644 --- a/monkey/infection_monkey/telemetry/attack/victim_host_telem.py +++ b/monkey/infection_monkey/telemetry/attack/victim_host_telem.py @@ -7,7 +7,8 @@ class VictimHostTelem(AttackTelem): def __init__(self, technique, status, machine): """ - ATT&CK telemetry that parses and sends VictimHost's (remote machine's) data + ATT&CK telemetry. + When `send` is called, it will parse and send the VictimHost's (remote machine's) data. :param technique: Technique ID. E.g. T111 :param status: ScanStatus of technique :param machine: VictimHost obj from model/host.py diff --git a/monkey/infection_monkey/telemetry/base_telem.py b/monkey/infection_monkey/telemetry/base_telem.py index 7bec9e890..d280ebfee 100644 --- a/monkey/infection_monkey/telemetry/base_telem.py +++ b/monkey/infection_monkey/telemetry/base_telem.py @@ -1,12 +1,9 @@ import abc from infection_monkey.control import ControlClient -import logging __author__ = 'itay.mizeretz' -LOG = logging.getLogger(__name__) - class BaseTelem(object): """ @@ -34,6 +31,6 @@ class BaseTelem(object): @abc.abstractmethod def get_data(self): """ - :return: Telemetry type + :return: Data of telemetry (should be dict) """ pass