1
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2
# See LICENSE for details.
5
The parent class for all the SSH services. Currently implemented services
6
are ssh-userauth and ssh-connection.
8
Maintainer: Paul Swartz
12
from twisted.python import log
14
class SSHService(log.Logger):
15
name = None # this is the ssh name for the service
16
protocolMessages = {} # these map #'s -> protocol names
17
transport = None # gets set later
19
def serviceStarted(self):
21
called when the service is active on the transport.
24
def serviceStopped(self):
26
called when the service is stopped, either by the connection ending
27
or by another service being started
31
return "SSHService %s on %s" % (self.name,
32
self.transport.transport.logPrefix())
34
def packetReceived(self, messageNum, packet):
36
called when we receive a packet on the transport
38
#print self.protocolMessages
39
if messageNum in self.protocolMessages:
40
messageType = self.protocolMessages[messageNum]
41
f = getattr(self,'ssh_%s' % messageType[4:],
45
log.msg("couldn't handle %r" % messageNum)
47
self.transport.sendUnimplemented()