forked from p15670423/monkey
Island, Common: Add services to machine.py
This commit is contained in:
parent
a390c97b70
commit
8bf1d1f46f
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from enum import Enum, auto
|
||||
from ipaddress import IPv4Address
|
||||
from typing import Dict, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
@ -28,6 +28,10 @@ JSONSerializable = Union[ # type: ignore[misc]
|
|||
]
|
||||
|
||||
|
||||
class NetworkServiceNameEnum(Enum):
|
||||
UNKNOWN = auto()
|
||||
|
||||
|
||||
class NetworkPort(ConstrainedInt):
|
||||
"""
|
||||
Define network port as constrainer integer.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from ipaddress import IPv4Interface
|
||||
from typing import Optional, Sequence
|
||||
from typing import Mapping, Optional, Sequence
|
||||
|
||||
from pydantic import Field, validator
|
||||
|
||||
from common import OperatingSystem
|
||||
from common.base_models import MutableInfectionMonkeyBaseModel
|
||||
from common.transforms import make_immutable_sequence
|
||||
from common.types import HardwareID
|
||||
from common.types import HardwareID, NetworkServiceNameEnum, SocketAddress
|
||||
|
||||
from . import MachineID
|
||||
|
||||
|
@ -35,6 +35,9 @@ class Machine(MutableInfectionMonkeyBaseModel):
|
|||
hostname: str = ""
|
||||
"""The hostname of the machine"""
|
||||
|
||||
network_services: Mapping[SocketAddress, NetworkServiceNameEnum]
|
||||
"""All network services found running on the machine"""
|
||||
|
||||
_make_immutable_sequence = validator("network_interfaces", pre=True, allow_reuse=True)(
|
||||
make_immutable_sequence
|
||||
)
|
||||
|
|
|
@ -9,14 +9,13 @@ from common.agent_configuration.agent_sub_configurations import (
|
|||
)
|
||||
from common.agent_events import ExploitationEvent, PingScanEvent, PropagationEvent, TCPScanEvent
|
||||
from common.credentials import Credentials, LMHash, NTHash
|
||||
from common.types import NetworkPort
|
||||
from infection_monkey.exploit.HostExploiter.HostExploiter import (
|
||||
_publish_exploitation_event,
|
||||
_publish_propagation_event,
|
||||
)
|
||||
from common.types import NetworkPort, NetworkServiceNameEnum
|
||||
from infection_monkey.exploit.log4shell_utils.ldap_server import LDAPServerFactory
|
||||
from monkey_island.cc.event_queue import IslandEventTopic, PyPubSubIslandEventQueue
|
||||
from monkey_island.cc.models import Report
|
||||
from monkey_island.cc.models import Machine, Node, Report
|
||||
from monkey_island.cc.models.networkmap import Arc, NetworkMap
|
||||
from monkey_island.cc.repository import MongoAgentRepository, MongoMachineRepository
|
||||
from monkey_island.cc.repository.attack.IMitigationsRepository import IMitigationsRepository
|
||||
|
@ -340,3 +339,8 @@ SCANNED
|
|||
EXPLOITED
|
||||
CC
|
||||
CC_TUNNEL
|
||||
|
||||
# TODO remove when 2267 is done
|
||||
NetworkServiceNameEnum.UNKNOWN
|
||||
Machine.network_services
|
||||
Node.tcp_connections
|
||||
|
|
Loading…
Reference in New Issue