From 501f75224829fc60cc8665dc6e1798f1514362af Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Mon, 29 Aug 2022 13:55:49 +0530 Subject: [PATCH] Common: Create PropagationConfiguration using pydantic --- .../agent_sub_configurations.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/monkey/common/agent_configuration/agent_sub_configurations.py b/monkey/common/agent_configuration/agent_sub_configurations.py index 11e4b7b78..9091058da 100644 --- a/monkey/common/agent_configuration/agent_sub_configurations.py +++ b/monkey/common/agent_configuration/agent_sub_configurations.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import Dict, Tuple -from pydantic import PositiveFloat, conint, validator +from pydantic import PositiveFloat, PositiveInt, conint, validator from common.base_models import MutableInfectionMonkeyBaseModel @@ -337,3 +337,20 @@ class PropagationConfiguration: maximum_depth: int network_scan: NetworkScanConfiguration exploitation: ExploitationConfiguration + + +class Pydantic___PropagationConfiguration: + """ + A configuration for propagation + + Attributes: + :param maximum_depth: Maximum number of hops allowed to spread from the machine where + the attack started i.e. how far to propagate in the network from the + first machine + :param network_scan: Configuration for network scanning + :param exploitation: Configuration for exploitation + """ + + maximum_depth: PositiveInt + network_scan: Pydantic___NetworkScanConfiguration + exploitation: Pydantic___ExploitationConfiguration