forked from p15670423/monkey
Common,Agent: Move PortStatus to common.types
This commit is contained in:
parent
18f8594deb
commit
8ae11e9faa
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue