#2700 Fix docstrings in application configure methods
This commit is contained in:
@@ -890,7 +890,11 @@ class Node(SimComponent):
|
|||||||
Allows agents to install applications to the node.
|
Allows agents to install applications to the node.
|
||||||
|
|
||||||
:param request: list containing the application name as the only element
|
: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]
|
application_name = request[0]
|
||||||
if self.software_manager.software.get(application_name):
|
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.
|
This method is useful for allowing agents to take this action.
|
||||||
|
|
||||||
:param application: Application object that is currently associated with this node.
|
:param request: list containing the application name as the only element
|
||||||
:type application: Application
|
:type request: RequestFormat
|
||||||
:return: True if the application is uninstalled successfully, otherwise False.
|
: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]
|
application_name = request[0]
|
||||||
if application_name not in self.software_manager.software:
|
if application_name not in self.software_manager.software:
|
||||||
|
|||||||
@@ -72,6 +72,16 @@ class DoSBot(DatabaseClient, identifier="DoSBot"):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _configure(request: RequestFormat, context: Dict) -> RequestResponse:
|
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]:
|
if "target_ip_address" in request[-1]:
|
||||||
request[-1]["target_ip_address"] = IPv4Address(request[-1]["target_ip_address"])
|
request[-1]["target_ip_address"] = IPv4Address(request[-1]["target_ip_address"])
|
||||||
if "target_port" in request[-1]:
|
if "target_port" in request[-1]:
|
||||||
@@ -102,6 +112,8 @@ class DoSBot(DatabaseClient, identifier="DoSBot"):
|
|||||||
:param: dos_intensity: The intensity of the DoS attack.
|
:param: dos_intensity: The intensity of the DoS attack.
|
||||||
Multiplied with the application's max session - Default is 1.0
|
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
|
: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_ip_address = target_ip_address
|
||||||
self.target_port = target_port
|
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 main application loop for the Denial of Service bot.
|
||||||
|
|
||||||
The loop goes through the stages of a DoS attack.
|
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():
|
if not self._can_perform_action():
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -64,6 +64,16 @@ class RansomwareScript(Application, identifier="RansomwareScript"):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _configure(request: RequestFormat, context: Dict) -> RequestResponse:
|
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 = request[-1].get("server_ip_address")
|
||||||
ip = None if ip is None else IPv4Address(ip)
|
ip = None if ip is None else IPv4Address(ip)
|
||||||
pw = request[-1].get("server_password")
|
pw = request[-1].get("server_password")
|
||||||
|
|||||||
Reference in New Issue
Block a user