From 80cd5a05a12a8b9632c154c9e2188b1cf996a7a4 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 13 Sep 2022 13:08:00 -0400 Subject: [PATCH] Common: Move AgentID definition to common --- monkey/common/types.py | 3 +++ monkey/monkey_island/cc/models/__init__.py | 3 ++- monkey/monkey_island/cc/models/agent.py | 6 +----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/monkey/common/types.py b/monkey/common/types.py index d1808d762..56dee91a5 100644 --- a/monkey/common/types.py +++ b/monkey/common/types.py @@ -1,4 +1,7 @@ +from uuid import UUID + from pydantic import PositiveInt from typing_extensions import TypeAlias +AgentID: TypeAlias = UUID HardwareID: TypeAlias = PositiveInt diff --git a/monkey/monkey_island/cc/models/__init__.py b/monkey/monkey_island/cc/models/__init__.py index 29c38674a..30cb5ad95 100644 --- a/monkey/monkey_island/cc/models/__init__.py +++ b/monkey/monkey_island/cc/models/__init__.py @@ -12,4 +12,5 @@ from .user_credentials import UserCredentials from .machine import Machine, MachineID from .communication_type import CommunicationType from .node import Node -from .agent import Agent, AgentID +from common.types import AgentID +from .agent import Agent diff --git a/monkey/monkey_island/cc/models/agent.py b/monkey/monkey_island/cc/models/agent.py index 66bca7b54..c5ae10d22 100644 --- a/monkey/monkey_island/cc/models/agent.py +++ b/monkey/monkey_island/cc/models/agent.py @@ -1,15 +1,11 @@ from datetime import datetime from typing import Optional -from uuid import UUID from pydantic import Field -from typing_extensions import TypeAlias from common.base_models import MutableInfectionMonkeyBaseModel -from . import MachineID - -AgentID: TypeAlias = UUID +from . import AgentID, MachineID class Agent(MutableInfectionMonkeyBaseModel):