sshmitm.clients.powershell module
- class sshmitm.clients.powershell.PowerShellClient(host, port, method, password, user, key, session)
Bases:
SSHClientSSH client used to connect to a remote host with the PowerShell remoting subsystem.
PowerShell remoting over SSH (PSRP) is started on the remote host with
pwsh -sshsregistered as thepowershellSSH subsystem. This client reuses the transport of an already authenticatedSSHClientand only tracks how many subsystem channels are currently active.- Parameters:
host (
str) – the hostname or IP address of the remote hostport (
int) – the port number to connect to on the remote hostmethod (
AuthenticationMethod) – the authentication method to use when connectingpassword (
str|None) – the password to use for authentication (if method is password)user (
str) – the username to use for authenticationkey (
PKey|None) – the public key to use for authentication (if method is publickey)session (
Session) – the session instance
- close()
- Return type:
None
- classmethod from_client(ssh_client)
Create a PowerShellClient instance from an SSHClient instance.
- Parameters:
ssh_client (
SSHClient|None) – The SSHClient instance.- Return type:
Optional[PowerShellClient]- Returns:
A PowerShellClient instance, or None if it could not be created.
- property running: bool
Indicate whether the powershell client is running.
- Returns:
Whether the powershell client is running.