1
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2
# See LICENSE for details.
6
"""The parent class for all the SSH services. Currently implemented services are: ssh-userauth and ssh-connection.
8
This module is unstable.
10
Maintainer: U{Paul Swartz<mailto:z3p@twistedmatrix.com>}
14
from twisted.python import log
16
class SSHService(log.Logger):
17
name = None # this is the ssh name for the service
18
protocolMessages = {} # these map #'s -> protocol names
19
transport = None # gets set later
21
def serviceStarted(self):
23
called when the service is active on the transport.
26
def serviceStopped(self):
28
called when the service is stopped, either by the connection ending
29
or by another service being started
33
return "SSHService %s on %s" % (self.name, self.transport.transport.logPrefix())
35
def packetReceived(self, messageType, packet):
37
called when we receieve a packet on the transport
39
#print self.protocolMessages
40
f = getattr(self,'ssh_%s' % self.protocolMessages[messageType][4:], None)
44
log.msg("couldn't handle", messageType)
45
log.msg(repr(packet[1:]))
46
self.transport.sendUnimplemented()