forked from p15670423/monkey
Fix CR comments
This commit is contained in:
parent
b2eef28291
commit
93d6280d1a
|
@ -1,11 +1,7 @@
|
||||||
import logging
|
|
||||||
|
|
||||||
from infection_monkey.telemetry.base_telem import BaseTelem
|
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||||
|
|
||||||
__author__ = "VakarisZ"
|
__author__ = "VakarisZ"
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class AttackTelem(BaseTelem):
|
class AttackTelem(BaseTelem):
|
||||||
|
|
||||||
|
|
|
@ -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)
|
|
@ -7,7 +7,8 @@ class VictimHostTelem(AttackTelem):
|
||||||
|
|
||||||
def __init__(self, technique, status, machine):
|
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 technique: Technique ID. E.g. T111
|
||||||
:param status: ScanStatus of technique
|
:param status: ScanStatus of technique
|
||||||
:param machine: VictimHost obj from model/host.py
|
:param machine: VictimHost obj from model/host.py
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from infection_monkey.control import ControlClient
|
from infection_monkey.control import ControlClient
|
||||||
import logging
|
|
||||||
|
|
||||||
__author__ = 'itay.mizeretz'
|
__author__ = 'itay.mizeretz'
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class BaseTelem(object):
|
class BaseTelem(object):
|
||||||
"""
|
"""
|
||||||
|
@ -34,6 +31,6 @@ class BaseTelem(object):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
"""
|
"""
|
||||||
:return: Telemetry type
|
:return: Data of telemetry (should be dict)
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue