Skip to content

Commit

Permalink
Merge pull request #224 from Limmen/dev1
Browse files Browse the repository at this point in the history
fixed typings in several action- and config files
  • Loading branch information
Limmen authored Aug 17, 2023
2 parents 0fdcbba + 8fd20e1 commit eb28dc4
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from csle_common.dao.emulation_action.defender.emulation_defender_action_type import EmulationDefenderActionType
from csle_common.dao.emulation_action.defender.emulation_defender_action_id import EmulationDefenderActionId
from csle_common.dao.emulation_action.defender.emulation_defender_action_outcome import EmulationDefenderActionOutcome

from typing import List

class EmulationDefenderStoppingActions:
"""
Expand All @@ -18,8 +18,8 @@ def STOP(index: int) -> EmulationDefenderAction:
:return: the action
"""
id = EmulationDefenderActionId.STOP
cmd = []
alt_cmd = []
cmd: List[str] = []
alt_cmd: List[str] = []
return EmulationDefenderAction(id=id, name="Report Intrusion", cmds=cmd,
type=EmulationDefenderActionType.STOP,
descr="Reports an ongoing intrusion to the infrastructure and stops",
Expand All @@ -35,8 +35,8 @@ def CONTINUE(index: int) -> EmulationDefenderAction:
:return: the action
"""
id = EmulationDefenderActionId.CONTINUE
cmd = []
alt_cmd = []
cmd: List[str] = []
alt_cmd: List[str] = []
return EmulationDefenderAction(
id=id, name="Continue", cmds=cmd, type=EmulationDefenderActionType.CONTINUE,
descr="A 'continue' action, the defender chooses to not make any action", index=index, ips=[],
Expand All @@ -52,8 +52,8 @@ def RESET_USERS(index: int) -> EmulationDefenderAction:
:return: the action
"""
id = EmulationDefenderActionId.RESET_USERS
cmd = []
alt_cmd = []
cmd: List[str] = []
alt_cmd: List[str] = []
return EmulationDefenderAction(
id=id, name="Reset Users", cmds=cmd, type=EmulationDefenderActionType.ADD_DEFENSIVE_MECHANISM,
descr="A non terminal stop action the defender resets all user accounts, which means that "
Expand All @@ -69,8 +69,8 @@ def ENABLE_DPI(index: int) -> EmulationDefenderAction:
:return: the action
"""
id = EmulationDefenderActionId.ENABLE_DPI
cmd = []
alt_cmd = []
cmd: List[str] = []
alt_cmd: List[str] = []
return EmulationDefenderAction(id=id, name="Enable DPI", cmds=cmd,
type=EmulationDefenderActionType.ADD_DEFENSIVE_MECHANISM,
descr="A non terminal stop action, the defender enables DPI by starting the IDS",
Expand All @@ -88,8 +88,8 @@ def BLACKLIST_IPS(index: int) -> EmulationDefenderAction:
:return: the action
"""
id = EmulationDefenderActionId.BLACKLIST_IPS
cmd = []
alt_cmd = []
cmd: List[str] = []
alt_cmd: List[str] = []
return EmulationDefenderAction(
id=id, name="Blacklist IPs", cmds=cmd,
type=EmulationDefenderActionType.ADD_DEFENSIVE_MECHANISM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["username"] = self.username
d["pw"] = self.pw
d["state"] = self.state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["ip"] = self.ip
d["networks"] = list(map(lambda x: x.to_dict(), self.networks))
d["client_manager_port"] = self.client_manager_port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["ip"] = self.ip
d["log_files_paths"] = self.log_files_paths
d["filebeat_modules"] = self.filebeat_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["ip"] = self.ip
d["flags"] = list(map(lambda x: x.to_dict(), self.flags))
d["docker_gw_bridge_ip"] = self.docker_gw_bridge_ip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["ip"] = self.ip
d["commands"] = self.commands
d["traffic_manager_port"] = self.traffic_manager_port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["ip"] = self.ip
d["users"] = list(map(lambda x: x.to_dict(), self.users))
d["docker_gw_bridge_ip"] = self.docker_gw_bridge_ip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: Dict[str, Any] = {}
d["ip"] = self.ip
d["vuln_type"] = self.vuln_type
d["name"] = self.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def to_dict(self) -> Dict[str, Any]:
:return: a dict representation of the object
"""
d = {}
d: List[str, Any] = {}
d["ip"] = self.ip
d["container_name"] = self.container_name
d["openflow_protocols"] = self.openflow_protocols
Expand Down

0 comments on commit eb28dc4

Please sign in to comment.