#2710 - commit before changing branch
This commit is contained in:
@@ -145,7 +145,6 @@ class Terminal(Service):
|
|||||||
def validate_user(self, user: Dict[str]) -> bool:
|
def validate_user(self, user: Dict[str]) -> bool:
|
||||||
return True if user.get("username") in self.user_connections else False
|
return True if user.get("username") in self.user_connections else False
|
||||||
|
|
||||||
|
|
||||||
def _ssh_process_logoff(self, dest_ip_address: IPv4Address, user_account: dict, **kwargs) -> bool:
|
def _ssh_process_logoff(self, dest_ip_address: IPv4Address, user_account: dict, **kwargs) -> bool:
|
||||||
"""Process the logoff attempt. Return a bool if succesful or unsuccessful."""
|
"""Process the logoff attempt. Return a bool if succesful or unsuccessful."""
|
||||||
|
|
||||||
@@ -164,12 +163,16 @@ class Terminal(Service):
|
|||||||
"""Send confirmation of successful disconnect"""
|
"""Send confirmation of successful disconnect"""
|
||||||
transport_message = SSHTransportMessage.SSH_MSG_SERVICE_SUCCESS
|
transport_message = SSHTransportMessage.SSH_MSG_SERVICE_SUCCESS
|
||||||
connection_message = SSHConnectionMessage.SSH_MSG_CHANNEL_CLOSE
|
connection_message = SSHConnectionMessage.SSH_MSG_CHANNEL_CLOSE
|
||||||
payload: SSHPacket = SSHPacket(transport_message=transport_message, connection_message=connection_message, ssh_output=RequestResponse(status="success"))
|
payload: SSHPacket = SSHPacket(
|
||||||
|
transport_message=transport_message,
|
||||||
|
connection_message=connection_message,
|
||||||
|
ssh_output=RequestResponse(status="success"),
|
||||||
|
)
|
||||||
self.send(payload=payload)
|
self.send(payload=payload)
|
||||||
|
|
||||||
def receive(self, payload: SSHPacket, session_id: str, **kwargs) -> bool:
|
def receive(self, payload: SSHPacket, session_id: str, **kwargs) -> bool:
|
||||||
self.sys_log.debug(f"Received payload: {payload} from session: {session_id}")
|
self.sys_log.debug(f"Received payload: {payload} from session: {session_id}")
|
||||||
if payload.connection_message ==SSHConnectionMessage. SSH_MSG_CHANNEL_CLOSE:
|
if payload.connection_message == SSHConnectionMessage.SSH_MSG_CHANNEL_CLOSE:
|
||||||
result = self._ssh_process_logoff(session_id=session_id)
|
result = self._ssh_process_logoff(session_id=session_id)
|
||||||
# We need to close on the other machine as well
|
# We need to close on the other machine as well
|
||||||
self.send_logoff_ack()
|
self.send_logoff_ack()
|
||||||
@@ -191,7 +194,6 @@ class Terminal(Service):
|
|||||||
self.send(payload=result, session_id=session_id)
|
self.send(payload=result, session_id=session_id)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# %% Outbound
|
# %% Outbound
|
||||||
|
|
||||||
def login(self, dest_ip_address: IPv4Address) -> bool:
|
def login(self, dest_ip_address: IPv4Address) -> bool:
|
||||||
@@ -268,7 +270,6 @@ class Terminal(Service):
|
|||||||
self.connected = False
|
self.connected = False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def send(
|
def send(
|
||||||
self,
|
self,
|
||||||
payload: SSHPacket,
|
payload: SSHPacket,
|
||||||
@@ -276,4 +277,3 @@ class Terminal(Service):
|
|||||||
session_id: Optional[str] = None,
|
session_id: Optional[str] = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
return super().send(payload=payload, dest_ip_address=dest_ip_address, dest_port=Port.SSH, session_id=session_id)
|
return super().send(payload=payload, dest_ip_address=dest_ip_address, dest_port=Port.SSH, session_id=session_id)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user