# -*- test-case-name: twisted.conch.test.test_conch -*- from __future__ import absolute_import, division from zope.interface import implementer from twisted.conch.error import ConchError from twisted.conch.interfaces import IConchUser from twisted.conch.ssh.connection import OPEN_UNKNOWN_CHANNEL_TYPE from twisted.python import log from twisted.python.compat import nativeString @implementer(IConchUser) class ConchUser: def __init__(self): self.channelLookup = {} self.subsystemLookup = {} def lookupChannel(self, channelType, windowSize, maxPacket, data): klass = self.channelLookup.get(channelType, None) if not klass: raise ConchError(OPEN_UNKNOWN_CHANNEL_TYPE, "unknown channel") else: return klass(remoteWindow=windowSize, remoteMaxPacket=maxPacket, data=data, avatar=self) def lookupSubsystem(self, subsystem, data): log.msg(repr(self.subsystemLookup)) klass = self.subsystemLookup.get(subsystem, None) if not klass: return False return klass(data, avatar=self) def gotGlobalRequest(self, requestType, data): # XXX should this use method dispatch? requestType = nativeString(requestType.replace(b'-', b'_')) f = getattr(self, "global_%s" % requestType, None) if not f: return 0 return f(data)
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
client | Folder | 0755 |
|
|
insults | Folder | 0755 |
|
|
openssh_compat | Folder | 0755 |
|
|
scripts | Folder | 0755 |
|
|
ssh | Folder | 0755 |
|
|
test | Folder | 0755 |
|
|
ui | Folder | 0755 |
|
|
__init__.py | File | 515 B | 0644 |
|
avatar.py | File | 1.4 KB | 0644 |
|
checkers.py | File | 19.28 KB | 0644 |
|
endpoints.py | File | 28.33 KB | 0644 |
|
error.py | File | 2.65 KB | 0644 |
|
interfaces.py | File | 12.76 KB | 0644 |
|
ls.py | File | 2.49 KB | 0644 |
|
manhole.py | File | 11.3 KB | 0644 |
|
manhole_ssh.py | File | 3.9 KB | 0644 |
|
manhole_tap.py | File | 5.24 KB | 0644 |
|
mixin.py | File | 1.34 KB | 0644 |
|
recvline.py | File | 11.25 KB | 0644 |
|
stdio.py | File | 2.71 KB | 0644 |
|
tap.py | File | 3.11 KB | 0644 |
|
telnet.py | File | 37.64 KB | 0644 |
|
ttymodes.py | File | 2.19 KB | 0644 |
|
unix.py | File | 15.91 KB | 0644 |
|