forked from p15670423/monkey
Merge branch '2267-common-port-status' into develop
This commit is contained in:
commit
0207519343
|
@ -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
|
|
@ -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]
|
||||
|
|
|
@ -4,7 +4,6 @@ from .i_puppet import (
|
|||
ExploiterResultData,
|
||||
PortScanData,
|
||||
FingerprintData,
|
||||
PortStatus,
|
||||
PostBreachData,
|
||||
UnknownPluginError,
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ 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 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
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ from common.agent_configuration import (
|
|||
PropagationConfiguration,
|
||||
ScanTargetConfiguration,
|
||||
)
|
||||
from common.types import PingScanData
|
||||
from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData, PortStatus
|
||||
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
|
||||
from infection_monkey.network_scanning.scan_target_generator import compile_scan_target_list
|
||||
|
|
|
@ -5,8 +5,8 @@ from typing import Any, Dict
|
|||
import requests
|
||||
|
||||
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 common.types import PingScanData, PortStatus
|
||||
from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData
|
||||
|
||||
DISPLAY_NAME = "ElasticSearch"
|
||||
ES_PORT = 9200
|
||||
|
|
|
@ -5,8 +5,8 @@ from typing import Any, Dict, Iterable, Optional, Set, Tuple
|
|||
from requests import head
|
||||
from requests.exceptions import ConnectionError, Timeout
|
||||
|
||||
from common.types import PingScanData
|
||||
from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData, PortStatus
|
||||
from common.types import PingScanData, PortStatus
|
||||
from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ from typing import Dict
|
|||
from odict import odict
|
||||
|
||||
from common import OperatingSystem
|
||||
from common.types import PingScanData
|
||||
from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData, PortStatus
|
||||
from common.types import PingScanData, PortStatus
|
||||
from infection_monkey.i_puppet import FingerprintData, IFingerprinter, PortScanData
|
||||
|
||||
DISPLAY_NAME = "SMB"
|
||||
SMB_PORT = 445
|
||||
|
|
|
@ -5,8 +5,9 @@ import time
|
|||
from pprint import pformat
|
||||
from typing import Collection, Dict, Iterable, Mapping, Tuple
|
||||
|
||||
from common.types 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__)
|
||||
|
|
|
@ -4,14 +4,13 @@ from typing import Dict, Iterable, Sequence
|
|||
|
||||
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,
|
||||
IPuppet,
|
||||
PluginType,
|
||||
PortScanData,
|
||||
PortStatus,
|
||||
PostBreachData,
|
||||
)
|
||||
from infection_monkey.model import VictimHost
|
||||
|
|
|
@ -12,8 +12,8 @@ from common.agent_configuration.agent_sub_configurations import (
|
|||
PluginConfiguration,
|
||||
TCPScanConfiguration,
|
||||
)
|
||||
from common.types import PingScanData
|
||||
from infection_monkey.i_puppet import FingerprintData, PortScanData, PortStatus
|
||||
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
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ from common.agent_configuration.agent_sub_configurations import (
|
|||
PropagationConfiguration,
|
||||
ScanTargetConfiguration,
|
||||
)
|
||||
from common.types import PingScanData
|
||||
from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData, PortStatus
|
||||
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
|
||||
from infection_monkey.network import NetworkAddress
|
||||
|
|
|
@ -3,7 +3,8 @@ from unittest.mock import MagicMock
|
|||
import pytest
|
||||
|
||||
from common.common_consts.network_consts import ES_SERVICE
|
||||
from infection_monkey.i_puppet import PortScanData, PortStatus
|
||||
from common.types import PortStatus
|
||||
from infection_monkey.i_puppet import PortScanData
|
||||
from infection_monkey.network_scanning.elasticsearch_fingerprinter import (
|
||||
ES_PORT,
|
||||
ElasticSearchFingerprinter,
|
||||
|
|
|
@ -2,7 +2,8 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.i_puppet import PortScanData, PortStatus
|
||||
from common.types 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]}
|
||||
|
|
|
@ -3,7 +3,8 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.i_puppet import PortScanData, PortStatus
|
||||
from common.types import PortStatus
|
||||
from infection_monkey.i_puppet import PortScanData
|
||||
from infection_monkey.network_scanning.mssql_fingerprinter import (
|
||||
MSSQL_SERVICE,
|
||||
SQL_BROWSER_DEFAULT_PORT,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import pytest
|
||||
|
||||
from common import OperatingSystem
|
||||
from infection_monkey.i_puppet import FingerprintData, PortScanData, PortStatus
|
||||
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 infection_monkey.i_puppet 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