From c32013bf87131db4f1ba18cebb3b21e241bbb0e1 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Thu, 29 Sep 2022 18:34:01 +0200 Subject: [PATCH 1/3] Common: Add PortStatus enum --- monkey/common/__init__.py | 1 + monkey/common/port_status.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 monkey/common/port_status.py diff --git a/monkey/common/__init__.py b/monkey/common/__init__.py index 69190bce5..12e33e028 100644 --- a/monkey/common/__init__.py +++ b/monkey/common/__init__.py @@ -8,3 +8,4 @@ from . import types from . import base_models from .agent_registration_data import AgentRegistrationData from .agent_signals import AgentSignals +from .port_status import PortStatus diff --git a/monkey/common/port_status.py b/monkey/common/port_status.py new file mode 100644 index 000000000..8393e7a9a --- /dev/null +++ b/monkey/common/port_status.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class PortStatus(Enum): + """ + An Enum representing the status of the port. + + This Enum represents the status of a network pork. The value of each + member is distincive and unique number. + """ + + OPEN = 1 + CLOSED = 2 From 18f8594deb1a0f05c44b59e4f489ffd4cde651ac Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Thu, 29 Sep 2022 19:03:21 +0200 Subject: [PATCH 2/3] Agent: Use common.PortStatus instead of i_puppet.PortStatus --- monkey/infection_monkey/i_puppet/__init__.py | 1 - monkey/infection_monkey/i_puppet/i_puppet.py | 6 ------ monkey/infection_monkey/master/ip_scanner.py | 3 ++- monkey/infection_monkey/master/propagator.py | 3 ++- .../network_scanning/elasticsearch_fingerprinter.py | 3 ++- .../infection_monkey/network_scanning/http_fingerprinter.py | 3 ++- .../infection_monkey/network_scanning/smb_fingerprinter.py | 4 ++-- monkey/infection_monkey/network_scanning/tcp_scanner.py | 3 ++- .../tests/unit_tests/infection_monkey/master/mock_puppet.py | 3 +-- .../unit_tests/infection_monkey/master/test_ip_scanner.py | 4 ++-- .../unit_tests/infection_monkey/master/test_propagator.py | 4 ++-- .../network_scanning/test_elasticsearch_fingerprinter.py | 3 ++- .../network_scanning/test_http_fingerprinter.py | 3 ++- .../network_scanning/test_mssql_fingerprinter.py | 3 ++- .../network_scanning/test_ssh_fingerprinter.py | 4 ++-- .../infection_monkey/network_scanning/test_tcp_scanner.py | 2 +- 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/monkey/infection_monkey/i_puppet/__init__.py b/monkey/infection_monkey/i_puppet/__init__.py index d38183700..2207d8ba6 100644 --- a/monkey/infection_monkey/i_puppet/__init__.py +++ b/monkey/infection_monkey/i_puppet/__init__.py @@ -4,7 +4,6 @@ from .i_puppet import ( ExploiterResultData, PortScanData, FingerprintData, - PortStatus, PostBreachData, UnknownPluginError, ) diff --git a/monkey/infection_monkey/i_puppet/i_puppet.py b/monkey/infection_monkey/i_puppet/i_puppet.py index 57e62c5bd..eea587ac2 100644 --- a/monkey/infection_monkey/i_puppet/i_puppet.py +++ b/monkey/infection_monkey/i_puppet/i_puppet.py @@ -2,7 +2,6 @@ import abc import threading from collections import namedtuple from dataclasses import dataclass -from enum import Enum from typing import Dict, Iterable, Mapping, Optional, Sequence from common.credentials import Credentials @@ -12,11 +11,6 @@ from infection_monkey.model import VictimHost from . import PluginType -class PortStatus(Enum): - OPEN = 1 - CLOSED = 2 - - class UnknownPluginError(Exception): pass diff --git a/monkey/infection_monkey/master/ip_scanner.py b/monkey/infection_monkey/master/ip_scanner.py index d1534a6f5..dd46eeb2e 100644 --- a/monkey/infection_monkey/master/ip_scanner.py +++ b/monkey/infection_monkey/master/ip_scanner.py @@ -5,12 +5,13 @@ from queue import Queue from threading import Event from typing import Callable, Dict, Sequence +from common import PortStatus from common.agent_configuration.agent_sub_configurations import ( NetworkScanConfiguration, PluginConfiguration, ) from common.types import PingScanData -from infection_monkey.i_puppet import FingerprintData, IPuppet, PortScanData, PortStatus +from infection_monkey.i_puppet import FingerprintData, IPuppet, PortScanData from infection_monkey.network import NetworkAddress from infection_monkey.utils.threading import interruptible_iter, run_worker_threads diff --git a/monkey/infection_monkey/master/propagator.py b/monkey/infection_monkey/master/propagator.py index 371dad970..2c8235cfe 100644 --- a/monkey/infection_monkey/master/propagator.py +++ b/monkey/infection_monkey/master/propagator.py @@ -4,6 +4,7 @@ from queue import Queue from threading import Event from typing import List, Mapping, Sequence +from common import PortStatus from common.agent_configuration import ( ExploitationConfiguration, NetworkScanConfiguration, @@ -11,7 +12,7 @@ from common.agent_configuration import ( ScanTargetConfiguration, ) from common.types import PingScanData -from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData, PortStatus +from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData from infection_monkey.model import VictimHost, VictimHostFactory from infection_monkey.network import NetworkAddress from infection_monkey.network_scanning.scan_target_generator import compile_scan_target_list diff --git a/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py b/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py index 0d9b69e9e..df679642a 100644 --- a/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py +++ b/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py @@ -4,9 +4,10 @@ from typing import Any, Dict import requests +from common import PortStatus from common.common_consts.network_consts import ES_SERVICE from common.types import PingScanData -from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData, PortStatus +from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData DISPLAY_NAME = "ElasticSearch" ES_PORT = 9200 diff --git a/monkey/infection_monkey/network_scanning/http_fingerprinter.py b/monkey/infection_monkey/network_scanning/http_fingerprinter.py index b2238217a..85393794f 100644 --- a/monkey/infection_monkey/network_scanning/http_fingerprinter.py +++ b/monkey/infection_monkey/network_scanning/http_fingerprinter.py @@ -5,8 +5,9 @@ from typing import Any, Dict, Iterable, Optional, Set, Tuple from requests import head from requests.exceptions import ConnectionError, Timeout +from common import PortStatus from common.types import PingScanData -from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData, PortStatus +from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData logger = logging.getLogger(__name__) diff --git a/monkey/infection_monkey/network_scanning/smb_fingerprinter.py b/monkey/infection_monkey/network_scanning/smb_fingerprinter.py index a80aaf6b4..45954caec 100644 --- a/monkey/infection_monkey/network_scanning/smb_fingerprinter.py +++ b/monkey/infection_monkey/network_scanning/smb_fingerprinter.py @@ -5,9 +5,9 @@ from typing import Dict from odict import odict -from common import OperatingSystem +from common import OperatingSystem, PortStatus from common.types import PingScanData -from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData, PortStatus +from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData DISPLAY_NAME = "SMB" SMB_PORT = 445 diff --git a/monkey/infection_monkey/network_scanning/tcp_scanner.py b/monkey/infection_monkey/network_scanning/tcp_scanner.py index f103f1556..89c27857b 100644 --- a/monkey/infection_monkey/network_scanning/tcp_scanner.py +++ b/monkey/infection_monkey/network_scanning/tcp_scanner.py @@ -5,8 +5,9 @@ import time from pprint import pformat from typing import Collection, Dict, Iterable, Mapping, Tuple +from common import PortStatus from common.utils import Timer -from infection_monkey.i_puppet import PortScanData, PortStatus +from infection_monkey.i_puppet import PortScanData from infection_monkey.network.tools import BANNER_READ, DEFAULT_TIMEOUT, tcp_port_to_service logger = logging.getLogger(__name__) diff --git a/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py b/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py index 33ae899ef..71d12eaad 100644 --- a/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py +++ b/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py @@ -2,7 +2,7 @@ import logging import threading from typing import Dict, Iterable, Sequence -from common import OperatingSystem +from common import OperatingSystem, PortStatus from common.credentials import Credentials, LMHash, Password, SSHKeypair, Username from common.types import PingScanData from infection_monkey.i_puppet import ( @@ -11,7 +11,6 @@ from infection_monkey.i_puppet import ( IPuppet, PluginType, PortScanData, - PortStatus, PostBreachData, ) from infection_monkey.model import VictimHost diff --git a/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py b/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py index 3175b0f63..648198928 100644 --- a/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py +++ b/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py @@ -5,7 +5,7 @@ from unittest.mock import MagicMock import pytest from tests.unit_tests.infection_monkey.master.mock_puppet import MockPuppet -from common import OperatingSystem +from common import OperatingSystem, PortStatus from common.agent_configuration.agent_sub_configurations import ( ICMPScanConfiguration, NetworkScanConfiguration, @@ -13,7 +13,7 @@ from common.agent_configuration.agent_sub_configurations import ( TCPScanConfiguration, ) from common.types import PingScanData -from infection_monkey.i_puppet import FingerprintData, PortScanData, PortStatus +from infection_monkey.i_puppet import FingerprintData, PortScanData from infection_monkey.master import IPScanner from infection_monkey.network import NetworkAddress diff --git a/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py b/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py index f94df4c22..5b6052973 100644 --- a/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py +++ b/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py @@ -4,14 +4,14 @@ from unittest.mock import MagicMock import pytest -from common import OperatingSystem +from common import OperatingSystem, PortStatus from common.agent_configuration.agent_sub_configurations import ( NetworkScanConfiguration, PropagationConfiguration, ScanTargetConfiguration, ) from common.types import PingScanData -from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData, PortStatus +from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData from infection_monkey.master import IPScanResults, Propagator from infection_monkey.model import VictimHost, VictimHostFactory from infection_monkey.network import NetworkAddress diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py index 758dc4f35..be10ed1ee 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py @@ -2,8 +2,9 @@ from unittest.mock import MagicMock import pytest +from common import PortStatus from common.common_consts.network_consts import ES_SERVICE -from infection_monkey.i_puppet import PortScanData, PortStatus +from infection_monkey.i_puppet import PortScanData from infection_monkey.network_scanning.elasticsearch_fingerprinter import ( ES_PORT, ElasticSearchFingerprinter, diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py index dde307506..d89f1d429 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py @@ -2,7 +2,8 @@ from unittest.mock import MagicMock import pytest -from infection_monkey.i_puppet import PortScanData, PortStatus +from common import PortStatus +from infection_monkey.i_puppet import PortScanData from infection_monkey.network_scanning.http_fingerprinter import HTTPFingerprinter OPTIONS = {"http_ports": [80, 443, 1080, 8080, 9200]} diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py index 8ae7d7fca..a742a3775 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py @@ -3,7 +3,8 @@ from unittest.mock import MagicMock import pytest -from infection_monkey.i_puppet import PortScanData, PortStatus +from common import PortStatus +from infection_monkey.i_puppet import PortScanData from infection_monkey.network_scanning.mssql_fingerprinter import ( MSSQL_SERVICE, SQL_BROWSER_DEFAULT_PORT, diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py index 969104e57..4b021d1fa 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py @@ -1,7 +1,7 @@ import pytest -from common import OperatingSystem -from infection_monkey.i_puppet import FingerprintData, PortScanData, PortStatus +from common import OperatingSystem, PortStatus +from infection_monkey.i_puppet import FingerprintData, PortScanData from infection_monkey.network_scanning.ssh_fingerprinter import SSHFingerprinter diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py index 837b3da0d..a56782090 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py @@ -2,7 +2,7 @@ from unittest.mock import MagicMock import pytest -from infection_monkey.i_puppet import PortStatus +from common import PortStatus from infection_monkey.network_scanning import scan_tcp_ports from infection_monkey.network_scanning.tcp_scanner import EMPTY_PORT_SCAN From 8ae11e9faaf250e7e267016fd7c4a9bb997c0e18 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Thu, 29 Sep 2022 13:08:59 -0400 Subject: [PATCH 3/3] Common,Agent: Move PortStatus to common.types --- monkey/common/__init__.py | 1 - monkey/common/types.py | 13 +++++++++++++ monkey/infection_monkey/master/ip_scanner.py | 3 +-- monkey/infection_monkey/master/propagator.py | 3 +-- .../network_scanning/elasticsearch_fingerprinter.py | 3 +-- .../network_scanning/http_fingerprinter.py | 3 +-- .../network_scanning/smb_fingerprinter.py | 4 ++-- .../network_scanning/tcp_scanner.py | 2 +- .../infection_monkey/master/mock_puppet.py | 4 ++-- .../infection_monkey/master/test_ip_scanner.py | 4 ++-- .../infection_monkey/master/test_propagator.py | 4 ++-- .../test_elasticsearch_fingerprinter.py | 2 +- .../network_scanning/test_http_fingerprinter.py | 2 +- .../network_scanning/test_mssql_fingerprinter.py | 2 +- .../network_scanning/test_ssh_fingerprinter.py | 3 ++- .../network_scanning/test_tcp_scanner.py | 2 +- 16 files changed, 32 insertions(+), 23 deletions(-) diff --git a/monkey/common/__init__.py b/monkey/common/__init__.py index 12e33e028..69190bce5 100644 --- a/monkey/common/__init__.py +++ b/monkey/common/__init__.py @@ -8,4 +8,3 @@ from . import types from . import base_models from .agent_registration_data import AgentRegistrationData from .agent_signals import AgentSignals -from .port_status import PortStatus diff --git a/monkey/common/types.py b/monkey/common/types.py index c1263a466..439f07c63 100644 --- a/monkey/common/types.py +++ b/monkey/common/types.py @@ -1,6 +1,7 @@ from __future__ import annotations from dataclasses import dataclass +from enum import Enum from ipaddress import IPv4Address from typing import Optional from uuid import UUID @@ -23,6 +24,18 @@ class PingScanData: os: Optional[OperatingSystem] +class PortStatus(Enum): + """ + An Enum representing the status of the port. + + This Enum represents the status of a network pork. The value of each + member is distincive and unique number. + """ + + OPEN = 1 + CLOSED = 2 + + class SocketAddress(InfectionMonkeyBaseModel): ip: IPv4Address port: conint(ge=1, le=65535) # type: ignore[valid-type] diff --git a/monkey/infection_monkey/master/ip_scanner.py b/monkey/infection_monkey/master/ip_scanner.py index dd46eeb2e..4b2932e9e 100644 --- a/monkey/infection_monkey/master/ip_scanner.py +++ b/monkey/infection_monkey/master/ip_scanner.py @@ -5,12 +5,11 @@ from queue import Queue from threading import Event from typing import Callable, Dict, Sequence -from common import PortStatus from common.agent_configuration.agent_sub_configurations import ( NetworkScanConfiguration, PluginConfiguration, ) -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import FingerprintData, IPuppet, PortScanData from infection_monkey.network import NetworkAddress from infection_monkey.utils.threading import interruptible_iter, run_worker_threads diff --git a/monkey/infection_monkey/master/propagator.py b/monkey/infection_monkey/master/propagator.py index 2c8235cfe..21a4708fb 100644 --- a/monkey/infection_monkey/master/propagator.py +++ b/monkey/infection_monkey/master/propagator.py @@ -4,14 +4,13 @@ from queue import Queue from threading import Event from typing import List, Mapping, Sequence -from common import PortStatus from common.agent_configuration import ( ExploitationConfiguration, NetworkScanConfiguration, PropagationConfiguration, ScanTargetConfiguration, ) -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData from infection_monkey.model import VictimHost, VictimHostFactory from infection_monkey.network import NetworkAddress diff --git a/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py b/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py index df679642a..d0dd85db2 100644 --- a/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py +++ b/monkey/infection_monkey/network_scanning/elasticsearch_fingerprinter.py @@ -4,9 +4,8 @@ from typing import Any, Dict import requests -from common import PortStatus from common.common_consts.network_consts import ES_SERVICE -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData DISPLAY_NAME = "ElasticSearch" diff --git a/monkey/infection_monkey/network_scanning/http_fingerprinter.py b/monkey/infection_monkey/network_scanning/http_fingerprinter.py index 85393794f..94b6aa981 100644 --- a/monkey/infection_monkey/network_scanning/http_fingerprinter.py +++ b/monkey/infection_monkey/network_scanning/http_fingerprinter.py @@ -5,8 +5,7 @@ from typing import Any, Dict, Iterable, Optional, Set, Tuple from requests import head from requests.exceptions import ConnectionError, Timeout -from common import PortStatus -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData logger = logging.getLogger(__name__) diff --git a/monkey/infection_monkey/network_scanning/smb_fingerprinter.py b/monkey/infection_monkey/network_scanning/smb_fingerprinter.py index 45954caec..55e512812 100644 --- a/monkey/infection_monkey/network_scanning/smb_fingerprinter.py +++ b/monkey/infection_monkey/network_scanning/smb_fingerprinter.py @@ -5,8 +5,8 @@ from typing import Dict from odict import odict -from common import OperatingSystem, PortStatus -from common.types import PingScanData +from common import OperatingSystem +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData DISPLAY_NAME = "SMB" diff --git a/monkey/infection_monkey/network_scanning/tcp_scanner.py b/monkey/infection_monkey/network_scanning/tcp_scanner.py index 89c27857b..70ef3cc0f 100644 --- a/monkey/infection_monkey/network_scanning/tcp_scanner.py +++ b/monkey/infection_monkey/network_scanning/tcp_scanner.py @@ -5,7 +5,7 @@ import time from pprint import pformat from typing import Collection, Dict, Iterable, Mapping, Tuple -from common import PortStatus +from common.types import PortStatus from common.utils import Timer from infection_monkey.i_puppet import PortScanData from infection_monkey.network.tools import BANNER_READ, DEFAULT_TIMEOUT, tcp_port_to_service diff --git a/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py b/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py index 71d12eaad..6b5930e1d 100644 --- a/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py +++ b/monkey/tests/unit_tests/infection_monkey/master/mock_puppet.py @@ -2,9 +2,9 @@ import logging import threading from typing import Dict, Iterable, Sequence -from common import OperatingSystem, PortStatus +from common import OperatingSystem from common.credentials import Credentials, LMHash, Password, SSHKeypair, Username -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import ( ExploiterResultData, FingerprintData, diff --git a/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py b/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py index 648198928..8e6fa19c5 100644 --- a/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py +++ b/monkey/tests/unit_tests/infection_monkey/master/test_ip_scanner.py @@ -5,14 +5,14 @@ from unittest.mock import MagicMock import pytest from tests.unit_tests.infection_monkey.master.mock_puppet import MockPuppet -from common import OperatingSystem, PortStatus +from common import OperatingSystem from common.agent_configuration.agent_sub_configurations import ( ICMPScanConfiguration, NetworkScanConfiguration, PluginConfiguration, TCPScanConfiguration, ) -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import FingerprintData, PortScanData from infection_monkey.master import IPScanner from infection_monkey.network import NetworkAddress diff --git a/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py b/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py index 5b6052973..dda161630 100644 --- a/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py +++ b/monkey/tests/unit_tests/infection_monkey/master/test_propagator.py @@ -4,13 +4,13 @@ from unittest.mock import MagicMock import pytest -from common import OperatingSystem, PortStatus +from common import OperatingSystem from common.agent_configuration.agent_sub_configurations import ( NetworkScanConfiguration, PropagationConfiguration, ScanTargetConfiguration, ) -from common.types import PingScanData +from common.types import PingScanData, PortStatus from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData from infection_monkey.master import IPScanResults, Propagator from infection_monkey.model import VictimHost, VictimHostFactory diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py index be10ed1ee..21ce36cfa 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_elasticsearch_fingerprinter.py @@ -2,8 +2,8 @@ from unittest.mock import MagicMock import pytest -from common import PortStatus from common.common_consts.network_consts import ES_SERVICE +from common.types import PortStatus from infection_monkey.i_puppet import PortScanData from infection_monkey.network_scanning.elasticsearch_fingerprinter import ( ES_PORT, diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py index d89f1d429..b9abe26ef 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_http_fingerprinter.py @@ -2,7 +2,7 @@ from unittest.mock import MagicMock import pytest -from common import PortStatus +from common.types import PortStatus from infection_monkey.i_puppet import PortScanData from infection_monkey.network_scanning.http_fingerprinter import HTTPFingerprinter diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py index a742a3775..2271e5776 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_mssql_fingerprinter.py @@ -3,7 +3,7 @@ from unittest.mock import MagicMock import pytest -from common import PortStatus +from common.types import PortStatus from infection_monkey.i_puppet import PortScanData from infection_monkey.network_scanning.mssql_fingerprinter import ( MSSQL_SERVICE, diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py index 4b021d1fa..fe6dc70ca 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_ssh_fingerprinter.py @@ -1,6 +1,7 @@ import pytest -from common import OperatingSystem, PortStatus +from common import OperatingSystem +from common.types import PortStatus from infection_monkey.i_puppet import FingerprintData, PortScanData from infection_monkey.network_scanning.ssh_fingerprinter import SSHFingerprinter diff --git a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py index a56782090..bd5a66cb6 100644 --- a/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py +++ b/monkey/tests/unit_tests/infection_monkey/network_scanning/test_tcp_scanner.py @@ -2,7 +2,7 @@ from unittest.mock import MagicMock import pytest -from common import PortStatus +from common.types import PortStatus from infection_monkey.network_scanning import scan_tcp_ports from infection_monkey.network_scanning.tcp_scanner import EMPTY_PORT_SCAN