#2706 - Actioning review comments on example notebook and terminal class
This commit is contained in:
@@ -50,7 +50,9 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"demonstrate how we obtain the Terminal component"
|
||||
"The terminal can be accessed from a `HostNode` via the `software_manager` as demonstrated below. \n",
|
||||
"\n",
|
||||
"In the example, we have a basic network consisting of two computers "
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -89,7 +91,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The Terminal can be used to install new software. The code block below demonstrates how the Terminal class allows the user of `terminal_a`, on `computer_a`, to send a command to `computer_b` to install the `RansomwareScript` application. \n"
|
||||
"The Terminal can be used to send requests to install new software. The code block below demonstrates how the Terminal class allows the user of `terminal_a`, on `computer_a`, to send a command to `computer_b` to install the `RansomwareScript` application. \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -111,7 +113,7 @@
|
||||
" target_ip_address=computer_b.network_interface[1].ip_address,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"# Send commmand to install RansomwareScript\n",
|
||||
"# Send command to install RansomwareScript\n",
|
||||
"terminal_a.send(payload=payload, dest_ip_address=computer_b.network_interface[1].ip_address)"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -124,13 +124,13 @@ class Terminal(Service):
|
||||
return RequestResponse(status="failure", data={})
|
||||
|
||||
def _remote_login(request: List[Any], context: Any) -> RequestResponse:
|
||||
self._process_remote_login(username=request[0], password=request[1], ip_address=request[2])
|
||||
if self.is_connected:
|
||||
login = self._process_remote_login(username=request[0], password=request[1], ip_address=request[2])
|
||||
if login:
|
||||
return RequestResponse(status="success", data={})
|
||||
else:
|
||||
return RequestResponse(status="failure", data={})
|
||||
|
||||
def _execute(request: List[Any], context: Any) -> RequestResponse:
|
||||
def _execute_request(request: List[Any], context: Any) -> RequestResponse:
|
||||
"""Execute an instruction."""
|
||||
command: str = request[0]
|
||||
self.execute(command)
|
||||
@@ -156,7 +156,7 @@ class Terminal(Service):
|
||||
|
||||
rm.add_request(
|
||||
"Execute",
|
||||
request_type=RequestType(func=_execute, validator=_login_valid),
|
||||
request_type=RequestType(func=_execute_request, validator=_login_valid),
|
||||
)
|
||||
|
||||
rm.add_request("Logoff", request_type=RequestType(func=_logoff, validator=_login_valid))
|
||||
|
||||
Reference in New Issue
Block a user