diff --git a/src/primaite/simulator/network/hardware/base.py b/src/primaite/simulator/network/hardware/base.py index 1982b08f..6942d280 100644 --- a/src/primaite/simulator/network/hardware/base.py +++ b/src/primaite/simulator/network/hardware/base.py @@ -890,7 +890,11 @@ class Node(SimComponent): Allows agents to install applications to the node. :param request: list containing the application name as the only element - :type application: str + :type request: RequestFormat + :param context: additional context for resolving this action, currently unused + :type context: dict + :return: Request response with a success code if the application was installed. + :rtype: RequestResponse """ application_name = request[0] if self.software_manager.software.get(application_name): @@ -916,9 +920,12 @@ class Node(SimComponent): This method is useful for allowing agents to take this action. - :param application: Application object that is currently associated with this node. - :type application: Application - :return: True if the application is uninstalled successfully, otherwise False. + :param request: list containing the application name as the only element + :type request: RequestFormat + :param context: additional context for resolving this action, currently unused + :type context: dict + :return: Request response with a success code if the application was uninstalled. + :rtype: RequestResponse """ application_name = request[0] if application_name not in self.software_manager.software: diff --git a/src/primaite/simulator/system/applications/red_applications/dos_bot.py b/src/primaite/simulator/system/applications/red_applications/dos_bot.py index 01a375ee..fcad3b3e 100644 --- a/src/primaite/simulator/system/applications/red_applications/dos_bot.py +++ b/src/primaite/simulator/system/applications/red_applications/dos_bot.py @@ -72,6 +72,16 @@ class DoSBot(DatabaseClient, identifier="DoSBot"): ) def _configure(request: RequestFormat, context: Dict) -> RequestResponse: + """ + Configure the DoSBot. + + :param request: List with one element that is a dict of options to pass to the configure method. + :type request: RequestFormat + :param context: additional context for resolving this action, currently unused + :type context: dict + :return: Request Response object with a success code determining if the configuration was successful. + :rtype: RequestResponse + """ if "target_ip_address" in request[-1]: request[-1]["target_ip_address"] = IPv4Address(request[-1]["target_ip_address"]) if "target_port" in request[-1]: @@ -102,6 +112,8 @@ class DoSBot(DatabaseClient, identifier="DoSBot"): :param: dos_intensity: The intensity of the DoS attack. Multiplied with the application's max session - Default is 1.0 :param: max_sessions: The maximum number of sessions the DoS bot will attack with. Optional - Default is 1000 + :return: Always returns True + :rtype: bool """ self.target_ip_address = target_ip_address self.target_port = target_port @@ -126,6 +138,9 @@ class DoSBot(DatabaseClient, identifier="DoSBot"): The main application loop for the Denial of Service bot. The loop goes through the stages of a DoS attack. + + :return: True if the application loop could be executed, False otherwise. + :rtype: bool """ if not self._can_perform_action(): return False diff --git a/src/primaite/simulator/system/applications/red_applications/ransomware_script.py b/src/primaite/simulator/system/applications/red_applications/ransomware_script.py index 8d9d0d18..71e422c3 100644 --- a/src/primaite/simulator/system/applications/red_applications/ransomware_script.py +++ b/src/primaite/simulator/system/applications/red_applications/ransomware_script.py @@ -64,6 +64,16 @@ class RansomwareScript(Application, identifier="RansomwareScript"): ) def _configure(request: RequestFormat, context: Dict) -> RequestResponse: + """ + Request for configuring the target database and payload. + + :param request: Request with one element contianing a dict of parameters for the configure method. + :type request: RequestFormat + :param context: additional context for resolving this action, currently unused + :type context: dict + :return: RequestResponse object with a success code reflecting whether the configuration could be applied. + :rtype: RequestResponse + """ ip = request[-1].get("server_ip_address") ip = None if ip is None else IPv4Address(ip) pw = request[-1].get("server_password")