diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_attack_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_attack_telem.py index 750075fb2..5d14d0aad 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_attack_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_attack_telem.py @@ -5,7 +5,7 @@ from infection_monkey.telemetry.attack.attack_telem import AttackTelem STATUS = ScanStatus.USED -TECHNIQUE = 'T9999' +TECHNIQUE = "T9999" @pytest.fixture @@ -15,7 +15,6 @@ def attack_telem_test_instance(): def test_attack_telem_send(attack_telem_test_instance, spy_send_telemetry): attack_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': TECHNIQUE} + expected_data = {"status": STATUS.value, "technique": TECHNIQUE} assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1005_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1005_telem.py index 757f0de13..528d6dca8 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1005_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1005_telem.py @@ -4,8 +4,8 @@ from common.utils.attack_utils import ScanStatus from infection_monkey.telemetry.attack.t1005_telem import T1005Telem -GATHERED_DATA_TYPE = '[Type of data collected]' -INFO = '[Additional info]' +GATHERED_DATA_TYPE = "[Type of data collected]" +INFO = "[Additional info]" STATUS = ScanStatus.USED @@ -16,9 +16,11 @@ def T1005_telem_test_instance(): def test_T1005_send(T1005_telem_test_instance, spy_send_telemetry): T1005_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1005', - 'gathered_data_type': GATHERED_DATA_TYPE, - 'info': INFO} + expected_data = { + "status": STATUS.value, + "technique": "T1005", + "gathered_data_type": GATHERED_DATA_TYPE, + "info": INFO, + } assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1035_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1035_telem.py index a3133fcb9..6c4e704bf 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1035_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1035_telem.py @@ -15,8 +15,6 @@ def T1035_telem_test_instance(): def test_T1035_send(T1035_telem_test_instance, spy_send_telemetry): T1035_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1035', - 'usage': USAGE.name} + expected_data = {"status": STATUS.value, "technique": "T1035", "usage": USAGE.name} assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1064_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1064_telem.py index 575b57540..fce3107ff 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1064_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1064_telem.py @@ -5,7 +5,7 @@ from infection_monkey.telemetry.attack.t1064_telem import T1064Telem STATUS = ScanStatus.USED -USAGE_STR = '[Usage info]' +USAGE_STR = "[Usage info]" @pytest.fixture @@ -15,8 +15,6 @@ def T1064_telem_test_instance(): def test_T1064_send(T1064_telem_test_instance, spy_send_telemetry): T1064_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1064', - 'usage': USAGE_STR} + expected_data = {"status": STATUS.value, "technique": "T1064", "usage": USAGE_STR} assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1105_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1105_telem.py index 050003e55..3b71bd56e 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1105_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1105_telem.py @@ -4,9 +4,9 @@ from common.utils.attack_utils import ScanStatus from infection_monkey.telemetry.attack.t1105_telem import T1105Telem -DST_IP = '0.0.0.1' -FILENAME = 'virus.exe' -SRC_IP = '0.0.0.0' +DST_IP = "0.0.0.1" +FILENAME = "virus.exe" +SRC_IP = "0.0.0.0" STATUS = ScanStatus.USED @@ -17,10 +17,12 @@ def T1105_telem_test_instance(): def test_T1105_send(T1105_telem_test_instance, spy_send_telemetry): T1105_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1105', - 'filename': FILENAME, - 'src': SRC_IP, - 'dst': DST_IP} + expected_data = { + "status": STATUS.value, + "technique": "T1105", + "filename": FILENAME, + "src": SRC_IP, + "dst": DST_IP, + } assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1106_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1106_telem.py index e47568c03..f51d124d0 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1106_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1106_telem.py @@ -15,8 +15,6 @@ def T1106_telem_test_instance(): def test_T1106_send(T1106_telem_test_instance, spy_send_telemetry): T1106_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1106', - 'usage': USAGE.name} + expected_data = {"status": STATUS.value, "technique": "T1106", "usage": USAGE.name} assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1107_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1107_telem.py index 2635f429b..2e519a934 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1107_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1107_telem.py @@ -4,7 +4,7 @@ from common.utils.attack_utils import ScanStatus from infection_monkey.telemetry.attack.t1107_telem import T1107Telem -PATH = 'path/to/file.txt' +PATH = "path/to/file.txt" STATUS = ScanStatus.USED @@ -15,8 +15,6 @@ def T1107_telem_test_instance(): def test_T1107_send(T1107_telem_test_instance, spy_send_telemetry): T1107_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1107', - 'path': PATH} + expected_data = {"status": STATUS.value, "technique": "T1107", "path": PATH} assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1129_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1129_telem.py index ce5562e1a..f07e83ae7 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1129_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1129_telem.py @@ -15,8 +15,6 @@ def T1129_telem_test_instance(): def test_T1129_send(T1129_telem_test_instance, spy_send_telemetry): T1129_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': 'T1129', - 'usage': USAGE.name} + expected_data = {"status": STATUS.value, "technique": "T1129", "usage": USAGE.name} assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1197_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1197_telem.py index 89d174090..c67832281 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1197_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1197_telem.py @@ -5,11 +5,11 @@ from infection_monkey.model import VictimHost from infection_monkey.telemetry.attack.t1197_telem import T1197Telem -DOMAIN_NAME = 'domain-name' -IP = '127.0.0.1' +DOMAIN_NAME = "domain-name" +IP = "127.0.0.1" MACHINE = VictimHost(IP, DOMAIN_NAME) STATUS = ScanStatus.USED -USAGE_STR = '[Usage info]' +USAGE_STR = "[Usage info]" @pytest.fixture @@ -19,10 +19,11 @@ def T1197_telem_test_instance(): def test_T1197_send(T1197_telem_test_instance, spy_send_telemetry): T1197_telem_test_instance.send() - expected_data = {'machine': {'domain_name': DOMAIN_NAME, - 'ip_addr': IP}, - 'status': STATUS.value, - 'technique': 'T1197', - 'usage': USAGE_STR} + expected_data = { + "machine": {"domain_name": DOMAIN_NAME, "ip_addr": IP}, + "status": STATUS.value, + "technique": "T1197", + "usage": USAGE_STR, + } assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_t1222_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_t1222_telem.py index 7a8f88a75..f053b9ca4 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_t1222_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_t1222_telem.py @@ -5,9 +5,9 @@ from infection_monkey.model import VictimHost from infection_monkey.telemetry.attack.t1222_telem import T1222Telem -COMMAND = 'echo hi' -DOMAIN_NAME = 'domain-name' -IP = '127.0.0.1' +COMMAND = "echo hi" +DOMAIN_NAME = "domain-name" +IP = "127.0.0.1" MACHINE = VictimHost(IP, DOMAIN_NAME) STATUS = ScanStatus.USED @@ -19,10 +19,11 @@ def T1222_telem_test_instance(): def test_T1222_send(T1222_telem_test_instance, spy_send_telemetry): T1222_telem_test_instance.send() - expected_data = {'machine': {'domain_name': DOMAIN_NAME, - 'ip_addr': IP}, - 'status': STATUS.value, - 'technique': 'T1222', - 'command': COMMAND} + expected_data = { + "machine": {"domain_name": DOMAIN_NAME, "ip_addr": IP}, + "status": STATUS.value, + "technique": "T1222", + "command": COMMAND, + } assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_usage_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_usage_telem.py index b707242a3..1a4009be9 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_usage_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_usage_telem.py @@ -5,7 +5,7 @@ from infection_monkey.telemetry.attack.usage_telem import UsageTelem STATUS = ScanStatus.USED -TECHNIQUE = 'T9999' +TECHNIQUE = "T9999" USAGE = UsageEnum.SMB @@ -16,8 +16,10 @@ def usage_telem_test_instance(): def test_usage_telem_send(usage_telem_test_instance, spy_send_telemetry): usage_telem_test_instance.send() - expected_data = {'status': STATUS.value, - 'technique': TECHNIQUE, - 'usage': USAGE.name} + expected_data = { + "status": STATUS.value, + "technique": TECHNIQUE, + "usage": USAGE.name, + } assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/attack/test_victim_host_telem.py b/monkey/infection_monkey/telemetry/tests/attack/test_victim_host_telem.py index 6a102983b..98d62f05b 100644 --- a/monkey/infection_monkey/telemetry/tests/attack/test_victim_host_telem.py +++ b/monkey/infection_monkey/telemetry/tests/attack/test_victim_host_telem.py @@ -5,11 +5,11 @@ from infection_monkey.model import VictimHost from infection_monkey.telemetry.attack.victim_host_telem import VictimHostTelem -DOMAIN_NAME = 'domain-name' -IP = '127.0.0.1' +DOMAIN_NAME = "domain-name" +IP = "127.0.0.1" MACHINE = VictimHost(IP, DOMAIN_NAME) STATUS = ScanStatus.USED -TECHNIQUE = 'T9999' +TECHNIQUE = "T9999" @pytest.fixture @@ -19,9 +19,10 @@ def victim_host_telem_test_instance(): def test_victim_host_telem_send(victim_host_telem_test_instance, spy_send_telemetry): victim_host_telem_test_instance.send() - expected_data = {'machine': {'domain_name': DOMAIN_NAME, - 'ip_addr': IP}, - 'status': STATUS.value, - 'technique': TECHNIQUE} + expected_data = { + "machine": {"domain_name": DOMAIN_NAME, "ip_addr": IP}, + "status": STATUS.value, + "technique": TECHNIQUE, + } assert spy_send_telemetry.data == expected_data - assert spy_send_telemetry.telem_category == 'attack' + assert spy_send_telemetry.telem_category == "attack" diff --git a/monkey/infection_monkey/telemetry/tests/conftest.py b/monkey/infection_monkey/telemetry/tests/conftest.py index dab650174..cbb1b8074 100644 --- a/monkey/infection_monkey/telemetry/tests/conftest.py +++ b/monkey/infection_monkey/telemetry/tests/conftest.py @@ -11,5 +11,5 @@ def spy_send_telemetry(monkeypatch): _spy_send_telemetry.telem_category = None _spy_send_telemetry.data = None - monkeypatch.setattr(ControlClient, 'send_telemetry', _spy_send_telemetry) + monkeypatch.setattr(ControlClient, "send_telemetry", _spy_send_telemetry) return _spy_send_telemetry diff --git a/monkey/infection_monkey/telemetry/tests/test_exploit_telem.py b/monkey/infection_monkey/telemetry/tests/test_exploit_telem.py index 92ca51ac3..a1d79ef64 100644 --- a/monkey/infection_monkey/telemetry/tests/test_exploit_telem.py +++ b/monkey/infection_monkey/telemetry/tests/test_exploit_telem.py @@ -8,22 +8,26 @@ from infection_monkey.telemetry.exploit_telem import ExploitTelem DOMAIN_NAME = "domain-name" IP = "0.0.0.0" HOST = VictimHost(IP, DOMAIN_NAME) -HOST_AS_DICT = {'ip_addr': IP, - 'domain_name': DOMAIN_NAME, - 'os': {}, - 'services': {}, - 'icmp': False, - 'monkey_exe': None, - 'default_tunnel': None, - 'default_server': None} +HOST_AS_DICT = { + "ip_addr": IP, + "domain_name": DOMAIN_NAME, + "os": {}, + "services": {}, + "icmp": False, + "monkey_exe": None, + "default_tunnel": None, + "default_server": None, +} EXPLOITER = WmiExploiter(HOST) -EXPLOITER_NAME = 'WmiExploiter' -EXPLOITER_INFO = {'display_name': WmiExploiter._EXPLOITED_SERVICE, - 'started': '', - 'finished': '', - 'vulnerable_urls': [], - 'vulnerable_ports': [], - 'executed_cmds': []} +EXPLOITER_NAME = "WmiExploiter" +EXPLOITER_INFO = { + "display_name": WmiExploiter._EXPLOITED_SERVICE, + "started": "", + "finished": "", + "vulnerable_urls": [], + "vulnerable_ports": [], + "executed_cmds": [], +} EXPLOITER_ATTEMPTS = [] RESULT = False diff --git a/monkey/infection_monkey/telemetry/tests/test_post_breach_telem.py b/monkey/infection_monkey/telemetry/tests/test_post_breach_telem.py index 5dd1123ab..adff1ca62 100644 --- a/monkey/infection_monkey/telemetry/tests/test_post_breach_telem.py +++ b/monkey/infection_monkey/telemetry/tests/test_post_breach_telem.py @@ -2,10 +2,12 @@ import pytest from common.data.post_breach_consts import POST_BREACH_JOB_SCHEDULING from infection_monkey.post_breach.actions.schedule_jobs import ScheduleJobs -from infection_monkey.post_breach.job_scheduling.linux_job_scheduling import \ - get_linux_commands_to_schedule_jobs -from infection_monkey.post_breach.job_scheduling.windows_job_scheduling import \ - get_windows_commands_to_schedule_jobs +from infection_monkey.post_breach.job_scheduling.linux_job_scheduling import ( + get_linux_commands_to_schedule_jobs, +) +from infection_monkey.post_breach.job_scheduling.windows_job_scheduling import ( + get_windows_commands_to_schedule_jobs, +) from infection_monkey.telemetry.post_breach_telem import PostBreachTelem from infection_monkey.utils.environment import is_windows_os @@ -13,8 +15,11 @@ from infection_monkey.utils.environment import is_windows_os HOSTNAME = "hostname" IP = "0.0.0.0" PBA = ScheduleJobs() -PBA_COMMAND = get_windows_commands_to_schedule_jobs() if is_windows_os() else\ - ' '.join(get_linux_commands_to_schedule_jobs()) +PBA_COMMAND = ( + get_windows_commands_to_schedule_jobs() + if is_windows_os() + else " ".join(get_linux_commands_to_schedule_jobs()) +) PBA_NAME = POST_BREACH_JOB_SCHEDULING RESULT = False diff --git a/monkey/infection_monkey/telemetry/tests/test_scan_telem.py b/monkey/infection_monkey/telemetry/tests/test_scan_telem.py index f35d84289..645cbbaf7 100644 --- a/monkey/infection_monkey/telemetry/tests/test_scan_telem.py +++ b/monkey/infection_monkey/telemetry/tests/test_scan_telem.py @@ -3,17 +3,20 @@ import pytest from infection_monkey.telemetry.scan_telem import ScanTelem from infection_monkey.model.host import VictimHost + DOMAIN_NAME = "domain-name" IP = "0.0.0.0" HOST = VictimHost(IP, DOMAIN_NAME) -HOST_AS_DICT = {'ip_addr': IP, - 'domain_name': DOMAIN_NAME, - 'os': {}, - 'services': {}, - 'icmp': False, - 'monkey_exe': None, - 'default_tunnel': None, - 'default_server': None} +HOST_AS_DICT = { + "ip_addr": IP, + "domain_name": DOMAIN_NAME, + "os": {}, + "services": {}, + "icmp": False, + "monkey_exe": None, + "default_tunnel": None, + "default_server": None, +} HOST_SERVICES = {} diff --git a/monkey/infection_monkey/telemetry/tests/test_state_telem.py b/monkey/infection_monkey/telemetry/tests/test_state_telem.py index a8beaf5ad..5d0eeabce 100644 --- a/monkey/infection_monkey/telemetry/tests/test_state_telem.py +++ b/monkey/infection_monkey/telemetry/tests/test_state_telem.py @@ -2,6 +2,7 @@ import pytest from infection_monkey.telemetry.state_telem import StateTelem + IS_DONE = True VERSION = "version" diff --git a/monkey/infection_monkey/telemetry/tests/test_system_info_telem.py b/monkey/infection_monkey/telemetry/tests/test_system_info_telem.py index 11692d4bb..dc362f7a7 100644 --- a/monkey/infection_monkey/telemetry/tests/test_system_info_telem.py +++ b/monkey/infection_monkey/telemetry/tests/test_system_info_telem.py @@ -2,6 +2,7 @@ import pytest from infection_monkey.telemetry.system_info_telem import SystemInfoTelem + SYSTEM_INFO = {} diff --git a/monkey/infection_monkey/telemetry/tests/test_trace_telem.py b/monkey/infection_monkey/telemetry/tests/test_trace_telem.py index e4bb06a6b..9b297c4ea 100644 --- a/monkey/infection_monkey/telemetry/tests/test_trace_telem.py +++ b/monkey/infection_monkey/telemetry/tests/test_trace_telem.py @@ -2,6 +2,7 @@ import pytest from infection_monkey.telemetry.trace_telem import TraceTelem + MSG = "message"