Common: Create PropagationConfiguration using pydantic

This commit is contained in:
Shreya Malviya 2022-08-29 13:55:49 +05:30
parent 602604e408
commit 501f752248
1 changed files with 18 additions and 1 deletions

View File

@ -1,7 +1,7 @@
from dataclasses import dataclass from dataclasses import dataclass
from typing import Dict, Tuple from typing import Dict, Tuple
from pydantic import PositiveFloat, conint, validator from pydantic import PositiveFloat, PositiveInt, conint, validator
from common.base_models import MutableInfectionMonkeyBaseModel from common.base_models import MutableInfectionMonkeyBaseModel
@ -337,3 +337,20 @@ class PropagationConfiguration:
maximum_depth: int maximum_depth: int
network_scan: NetworkScanConfiguration network_scan: NetworkScanConfiguration
exploitation: ExploitationConfiguration 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