Exscript.servers.sshd module

An SSH2 server.

class Exscript.servers.sshd.SSHd(host, port, device, key=None)[source]

Bases: Exscript.servers.server.Server

A SSH2 server. Usage:

device = VirtualDevice('myhost')
daemon = SSHd('localhost', 1234, device)
device.add_command('ls', 'ok', prompt = True)
device.add_command('exit', daemon.exit_command)
daemon.start() # Start the server.
daemon.exit()  # Stop the server.
daemon.join()  # Wait until it terminates.
Parameters:key – An Exscript.PrivateKey object.
__init__(host, port, device, key=None)[source]

Constructor.

Parameters:
  • host (str) – The address against which the daemon binds.
  • port (str) – The TCP port on which to listen.
  • device (VirtualDevice) – A virtual device instance.
  • encoding (str) – The encoding of data between client and server.