Agent: Use common.PortStatus instead of i_puppet.PortStatus

This commit is contained in:
Ilija Lazoroski 2022-09-29 19:03:21 +02:00 committed by Mike Salvatore
parent c32013bf87
commit 18f8594deb
16 changed files with 26 additions and 26 deletions

View File

@ -4,7 +4,6 @@ from .i_puppet import (
ExploiterResultData, ExploiterResultData,
PortScanData, PortScanData,
FingerprintData, FingerprintData,
PortStatus,
PostBreachData, PostBreachData,
UnknownPluginError, UnknownPluginError,
) )

View File

@ -2,7 +2,6 @@ import abc
import threading import threading
from collections import namedtuple from collections import namedtuple
from dataclasses import dataclass from dataclasses import dataclass
from enum import Enum
from typing import Dict, Iterable, Mapping, Optional, Sequence from typing import Dict, Iterable, Mapping, Optional, Sequence
from common.credentials import Credentials from common.credentials import Credentials
@ -12,11 +11,6 @@ from infection_monkey.model import VictimHost
from . import PluginType from . import PluginType
class PortStatus(Enum):
OPEN = 1
CLOSED = 2
class UnknownPluginError(Exception): class UnknownPluginError(Exception):
pass pass

View File

@ -5,12 +5,13 @@ from queue import Queue
from threading import Event from threading import Event
from typing import Callable, Dict, Sequence from typing import Callable, Dict, Sequence
from common import PortStatus
from common.agent_configuration.agent_sub_configurations import ( from common.agent_configuration.agent_sub_configurations import (
NetworkScanConfiguration, NetworkScanConfiguration,
PluginConfiguration, PluginConfiguration,
) )
from common.types import PingScanData 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.network import NetworkAddress
from infection_monkey.utils.threading import interruptible_iter, run_worker_threads from infection_monkey.utils.threading import interruptible_iter, run_worker_threads

View File

@ -4,6 +4,7 @@ from queue import Queue
from threading import Event from threading import Event
from typing import List, Mapping, Sequence from typing import List, Mapping, Sequence
from common import PortStatus
from common.agent_configuration import ( from common.agent_configuration import (
ExploitationConfiguration, ExploitationConfiguration,
NetworkScanConfiguration, NetworkScanConfiguration,
@ -11,7 +12,7 @@ from common.agent_configuration import (
ScanTargetConfiguration, ScanTargetConfiguration,
) )
from common.types import PingScanData 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.model import VictimHost, VictimHostFactory
from infection_monkey.network import NetworkAddress from infection_monkey.network import NetworkAddress
from infection_monkey.network_scanning.scan_target_generator import compile_scan_target_list from infection_monkey.network_scanning.scan_target_generator import compile_scan_target_list

View File

@ -4,9 +4,10 @@ from typing import Any, Dict
import requests import requests
from common import PortStatus
from common.common_consts.network_consts import ES_SERVICE from common.common_consts.network_consts import ES_SERVICE
from common.types import PingScanData 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" DISPLAY_NAME = "ElasticSearch"
ES_PORT = 9200 ES_PORT = 9200

View File

@ -5,8 +5,9 @@ from typing import Any, Dict, Iterable, Optional, Set, Tuple
from requests import head from requests import head
from requests.exceptions import ConnectionError, Timeout from requests.exceptions import ConnectionError, Timeout
from common import PortStatus
from common.types import PingScanData 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__) logger = logging.getLogger(__name__)

View File

@ -5,9 +5,9 @@ from typing import Dict
from odict import odict from odict import odict
from common import OperatingSystem from common import OperatingSystem, PortStatus
from common.types import PingScanData 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" DISPLAY_NAME = "SMB"
SMB_PORT = 445 SMB_PORT = 445

View File

@ -5,8 +5,9 @@ import time
from pprint import pformat from pprint import pformat
from typing import Collection, Dict, Iterable, Mapping, Tuple from typing import Collection, Dict, Iterable, Mapping, Tuple
from common import PortStatus
from common.utils import Timer 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 from infection_monkey.network.tools import BANNER_READ, DEFAULT_TIMEOUT, tcp_port_to_service
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -2,7 +2,7 @@ import logging
import threading import threading
from typing import Dict, Iterable, Sequence 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.credentials import Credentials, LMHash, Password, SSHKeypair, Username
from common.types import PingScanData from common.types import PingScanData
from infection_monkey.i_puppet import ( from infection_monkey.i_puppet import (
@ -11,7 +11,6 @@ from infection_monkey.i_puppet import (
IPuppet, IPuppet,
PluginType, PluginType,
PortScanData, PortScanData,
PortStatus,
PostBreachData, PostBreachData,
) )
from infection_monkey.model import VictimHost from infection_monkey.model import VictimHost

View File

@ -5,7 +5,7 @@ from unittest.mock import MagicMock
import pytest import pytest
from tests.unit_tests.infection_monkey.master.mock_puppet import MockPuppet 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 ( from common.agent_configuration.agent_sub_configurations import (
ICMPScanConfiguration, ICMPScanConfiguration,
NetworkScanConfiguration, NetworkScanConfiguration,
@ -13,7 +13,7 @@ from common.agent_configuration.agent_sub_configurations import (
TCPScanConfiguration, TCPScanConfiguration,
) )
from common.types import PingScanData 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.master import IPScanner
from infection_monkey.network import NetworkAddress from infection_monkey.network import NetworkAddress

View File

@ -4,14 +4,14 @@ from unittest.mock import MagicMock
import pytest import pytest
from common import OperatingSystem from common import OperatingSystem, PortStatus
from common.agent_configuration.agent_sub_configurations import ( from common.agent_configuration.agent_sub_configurations import (
NetworkScanConfiguration, NetworkScanConfiguration,
PropagationConfiguration, PropagationConfiguration,
ScanTargetConfiguration, ScanTargetConfiguration,
) )
from common.types import PingScanData 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.master import IPScanResults, Propagator
from infection_monkey.model import VictimHost, VictimHostFactory from infection_monkey.model import VictimHost, VictimHostFactory
from infection_monkey.network import NetworkAddress from infection_monkey.network import NetworkAddress

View File

@ -2,8 +2,9 @@ from unittest.mock import MagicMock
import pytest import pytest
from common import PortStatus
from common.common_consts.network_consts import ES_SERVICE 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 ( from infection_monkey.network_scanning.elasticsearch_fingerprinter import (
ES_PORT, ES_PORT,
ElasticSearchFingerprinter, ElasticSearchFingerprinter,

View File

@ -2,7 +2,8 @@ from unittest.mock import MagicMock
import pytest 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 from infection_monkey.network_scanning.http_fingerprinter import HTTPFingerprinter
OPTIONS = {"http_ports": [80, 443, 1080, 8080, 9200]} OPTIONS = {"http_ports": [80, 443, 1080, 8080, 9200]}

View File

@ -3,7 +3,8 @@ from unittest.mock import MagicMock
import pytest 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 ( from infection_monkey.network_scanning.mssql_fingerprinter import (
MSSQL_SERVICE, MSSQL_SERVICE,
SQL_BROWSER_DEFAULT_PORT, SQL_BROWSER_DEFAULT_PORT,

View File

@ -1,7 +1,7 @@
import pytest import pytest
from common import OperatingSystem from common import OperatingSystem, PortStatus
from infection_monkey.i_puppet import FingerprintData, PortScanData, PortStatus from infection_monkey.i_puppet import FingerprintData, PortScanData
from infection_monkey.network_scanning.ssh_fingerprinter import SSHFingerprinter from infection_monkey.network_scanning.ssh_fingerprinter import SSHFingerprinter

View File

@ -2,7 +2,7 @@ from unittest.mock import MagicMock
import pytest 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 import scan_tcp_ports
from infection_monkey.network_scanning.tcp_scanner import EMPTY_PORT_SCAN from infection_monkey.network_scanning.tcp_scanner import EMPTY_PORT_SCAN