The module provides a set of classes for implementing SSH-MITM clients in Python.
The AuthenticationMethod class is a helper class that provides different methods for authentication to a remote ssh server. It provides methods for authentication using passwords, private key files, and key-pair certificates. This class makes it easy to use different authentication methods in a consistent manner.
The BaseSSHClient class is an abstract class that provides the basic functionality for an ssh client. This class provides methods to connect to a remote server, create and use secure shell channels, and execute commands on the remote server. It is designed to be extended and customized for specific use cases.
The SSHClient class is a concrete implementation of the BaseSSHClient class. This class provides a high-level API for connecting to remote servers and performing operations over ssh. It uses the Paramiko library under the hood to handle the underlying ssh connectivity. This class makes it easy to connect to remote servers, execute commands, and transfer files.
- class sshmitm.clients.ssh.AuthenticationMethod(value)
An enumeration of possible authentication methods that can be used to connect to a remote host.
- AGENT = 'agent'
- PASSWORD = 'password'
- PUBLICKEY = 'publickey'
- class sshmitm.clients.ssh.BaseSSHClient(args=None, namespace=None, **kwargs)
” The base class for an SSH client module.
- class sshmitm.clients.ssh.SSHClient(host, port, method, password, user, key, session)
The SSH client class, used to connect to a remote host.
str) – the hostname or IP address of the remote host
int) – the port number to connect to on the remote host
AuthenticationMethod) – the authentication method to use when connecting
str]) – the password to use for authentication (if method is password)
str) – the username to use for authentication
PKey]) – the public key to use for authentication (if method is publickey)
Session) – the session instance
- CIPHERS = None
- check_host_key(hostname, keytype, key)
Check the host key.
str) – Hostname of the remote server.
str) – Type of the key.
PKey) – Key of the remote server.
- Return type:
True if the host key is valid, False otherwise.
Connects to the remote host using the specified authentication method.
- Return type:
True if the connection was successful, False otherwise