diff --git a/monkey/infection_monkey/utils/ids.py b/monkey/infection_monkey/utils/ids.py index a53672b93..fc53a5147 100644 --- a/monkey/infection_monkey/utils/ids.py +++ b/monkey/infection_monkey/utils/ids.py @@ -2,6 +2,8 @@ from uuid import UUID, getnode, uuid4 from common.types import HardwareID +_id = None + def get_agent_id() -> UUID: """ @@ -10,13 +12,11 @@ def get_agent_id() -> UUID: Each time an agent process starts, the return value of this function will be unique. Subsequent calls to this function from within the same process will have the same return value. """ - if get_agent_id._id is None: - get_agent_id._id = uuid4() + global _id + if _id is None: + _id = uuid4() - return get_agent_id._id - - -get_agent_id._id = None + return _id def get_machine_id() -> HardwareID: