Ejemplo n.º 1
0
 def __init__(self, repo, db):
     ConchUser.__init__(self)
     self.repo = repo
     self.db = db
     self.channelLookup.update(
         {b'fzone-chan': FZoneChanServerChannel,
          b'fzone-blob': FZoneBlobServerChannel})
Ejemplo n.º 2
0
 def __init__(self, user_id):
     ConchUser.__init__(self)
     self.user_id = user_id
     self.avatar_id = uuid.uuid4().hex
     self.channelLookup.update({'session': SSHSession})
     self.terminal = None
     self.term_size = (20, 80)
     self.ssh_protocol = None
Ejemplo n.º 3
0
    def __init__(self, username, root):
        ConchUser.__init__(self)
        self.username = username
        self.filesystem = pathutils.FileSystem(root)

        self.listeners = {}  # dict mapping (interface, port) -> listener
        self.channelLookup.update({"session": session.SSHSession})
        self.subsystemLookup.update({"sftp": FileTransferServer})
Ejemplo n.º 4
0
 def __init__(self, avatarId):
     assert self.protocolFactory is not None, (
         "When subclassing SSHBaseAvatar, set the "
         "`protocolFactory` attribute to a protocol factory`.  "
         "E.g. `SSHDemoProtocolFactory`")
     ConchUser.__init__(self)
     self.avatarId = avatarId
     self.channelLookup.update({'session': SSHSession})
Ejemplo n.º 5
0
 def requestAvatar(self, avatarId, mind, *interfaces):
     print "running requestAvatar"
     if IConchUser in interfaces:
          print "if statement"
          user = ConchUser()
          user.channelLookup['session'] = SimpleSession
          return IConchUser, user, nothing
     else:
          raise NotImplementedError("No supported interfaces found.")
Ejemplo n.º 6
0
    def __init__(self, username, root):
        ConchUser.__init__(self)
        self.username = username
        self.filesystem = pathutils.FileSystem(root)

        self.listeners = {}  # dict mapping (interface, port) -> listener
        self.channelLookup.update(
                {"session": session.SSHSession})
        self.subsystemLookup.update(
                {"sftp": FileTransferServer})
Ejemplo n.º 7
0
    def requestAvatar(self, avatarId, mind, *interfaces):
        if IConchUser in interfaces:
            user = ConchUser()
            user.channelLookup["session"] = Session
            return IConchUser, user, lambda: None

        if ITelnetProtocol in interfaces:
            return ITelnetProtocol, TelnetProxy(), lambda: None

        return None
Ejemplo n.º 8
0
    def __init__(self, siteId, cwd, uid):
        ConchUser.__init__(self)

        # Allow the user to open a channel of type session.  This implementation
        # will look up the ISession adapter for this site and use the resulting
        # object to authorize any SSH actions.
        self.channelLookup['session'] = SSHSession

        self.siteId = siteId
        self.cwd = cwd
        self.uid = uid
Ejemplo n.º 9
0
 def __init__(self, username, authnz, vcs_config):
     ConchUser.__init__(self)
     self.username = username
     self.authnz = authnz
     self.vcs_config = vcs_config
     self.channelLookup.update({"session": VCSSession})
     self.shell = {}
     # Find git-shell path.
     # Adapted from http://bugs.python.org/file15381/shutil_which.patch
     self.path = os.environ.get("PATH", os.defpath)
     self.shell['git'] = self._shells_find('git-shell')
     # self.shell['hd'] = self._shells_find('hg')
     self.shell['hg'] = '/usr/local/bin/hg'
Ejemplo n.º 10
0
    def requestAvatar(self, username, mind, *interfaces):
        """"
        The connection has already been authenticated at this point. Our job
        is to return some objects representing the logged in user.

        `username' is also known as the Avatar ID in `twisted.cred' terminology.
        """

        try:
            # treat username as an OTP and attempt 
            transport, protocol = self.tickets.pop(username)

            # reset routing ticket since it is one-time only.
            ticket = tickets.newTicket()
            self.tickets[ticket] = (transport, protocol)
            log.msg("Reset routing ticket from %s to %s" % (username, ticket,))

            u = ConchUser()
           
            # Add a custom field to indicate that this connection
            # is going to be connected (routed) using this ticket.
            u._connectTo = (transport, protocol)

            u.factory = self.factory
            u.options = self.factory.options
            return IConchUser, u, lambda:None

        except KeyError:
            log.msg('Username %r not recognized as access ticket. Connecting to public AMP subsystem only!' % (username,))
            # logged in user gets access to AMP subsystem only. No shells.
            u = ConchUser()
            u.factory = self.factory
            u.options = self.factory.options
            u.channelLookup['session'] = AMPSession
            return IConchUser, u, lambda:None
Ejemplo n.º 11
0
    def __init__(self, username):
        ConchUser.__init__(self)
        self.username = username
        self.pwdData = pwd.getpwnam(self.username)
        l = [self.pwdData[3]]
        for groupname, password, gid, userlist in grp.getgrall():
            if username in userlist:
                l.append(gid)
        self.otherGroups = l
        self.listeners = {}  # Dict mapping (interface, port) -> listener
        self.channelLookup.update(
                {b"session": session.SSHSession,
                 b"direct-tcpip": forwarding.openConnectForwardingClient})

        self.subsystemLookup.update(
                {b"sftp": filetransfer.FileTransferServer})
Ejemplo n.º 12
0
    def __init__(self, username):
        ConchUser.__init__(self)
        self.username = username
        self.pwdData = pwd.getpwnam(self.username)
        l = [self.pwdData[3]]
        for groupname, password, gid, userlist in grp.getgrall():
            if username in userlist:
                l.append(gid)
        self.otherGroups = l
        self.listeners = {}  # Dict mapping (interface, port) -> listener
        self.channelLookup.update(
                {"session": session.SSHSession,
                 "direct-tcpip": forwarding.openConnectForwardingClient})

        self.subsystemLookup.update(
                {"sftp": filetransfer.FileTransferServer})
Ejemplo n.º 13
0
    def requestAvatar(self, username, mind, *interfaces):
        """"
        The connection has already been authenticated at this point. Our job
        is to return some objects representing the logged in user.

        `username' is also known as the Avatar ID in `twisted.cred' terminology.
        """

        try:
            # treat username as an OTP and attempt
            transport, protocol = self.tickets.pop(username)

            # reset routing ticket since it is one-time only.
            ticket = tickets.newTicket()
            self.tickets[ticket] = (transport, protocol)
            log.msg("Reset routing ticket from %s to %s" % (
                username,
                ticket,
            ))

            u = ConchUser()

            # Add a custom field to indicate that this connection
            # is going to be connected (routed) using this ticket.
            u._connectTo = (transport, protocol)

            u.factory = self.factory
            u.options = self.factory.options
            return IConchUser, u, lambda: None

        except KeyError:
            log.msg(
                'Username %r not recognized as access ticket. Connecting to public AMP subsystem only!'
                % (username, ))
            # logged in user gets access to AMP subsystem only. No shells.
            u = ConchUser()
            u.factory = self.factory
            u.options = self.factory.options
            u.channelLookup['session'] = AMPSession
            return IConchUser, u, lambda: None
 def __init__(self, username, meta):
     ConchUser.__init__(self)
     self.username = username
     self.channelLookup.update({"session": SSHSession})
     self.meta = meta
Ejemplo n.º 15
0
 def __init__(self):
     ConchUser.__init__(self)
     self.channelLookup.update({'session': SSHSession})
Ejemplo n.º 16
0
 def requestAvatar(self, avatarId, mind, *interfaces):
     user = ConchUser()
     user.channelLookup['session'] = SimpleSession
     return IConchUser, user, nothing
Ejemplo n.º 17
0
 def __init__(self, username):
     ConchUser.__init__(self)
     self.username = username
     self.channelLookup.update({"session": GitProcessProtocolSession})
Ejemplo n.º 18
0
 def __init__(self, username, meta):
     ConchUser.__init__(self)
     self.username = username
     self.channelLookup.update({"session": SSHSession})
     self.meta = meta
Ejemplo n.º 19
0
 def __init__(self, root=None):
     ConchUser.__init__(self)
     self.channelLookup["session"] = ShelllessSession
Ejemplo n.º 20
0
 def __init__(self, key):
     ConchUser.__init__(self)
     # django, authentication model instance for logged in avatar
     self.user = key.user
     self.project = key.project
     self.channelLookup['session'] = GatewaySession
Ejemplo n.º 21
0
 def __init__(self):
     ConchUser.__init__(self)
     self.channelLookup.update({ 'session': SSHSession })
Ejemplo n.º 22
0
 def __init__(self):
     ConchUser.__init__(self)
     self.channelLookup['session'] = SSHSession
Ejemplo n.º 23
0
 def __init__(self):
     ConchUser.__init__(self)
     self.channelLookup[b'session'] = session.SSHSession
     self.subsystemLookup[b'sftp'] = filetransfer.FileTransferServer
Ejemplo n.º 24
0
 def __init__(self, avatarId):
     ConchUser.__init__(self)
     self.avatarId = avatarId
     self.channelLookup['session'] = session.SSHSession
Ejemplo n.º 25
0
 def __init__(self, username, datapath):
     ConchUser.__init__(self)
     self.username = username
     self.datapath = datapath
     self.channelLookup["session"] = SSHSession
Ejemplo n.º 26
0
 def requestAvatar(self, avatarId, mind, *interfaces):
     avatar = ConchUser()
     avatar.channelLookup = self.channelLookup
     return (IConchUser, avatar, lambda: None)
Ejemplo n.º 27
0
 def __init__(self, original, username):
     components.Adapter.__init__(self, original)
     ConchUser.__init__(self)
     self.username = username
     self.channelLookup.update({'session': FixedSSHSession})
     self.subsystemLookup.update({'sftp': FileTransferServer})
Ejemplo n.º 28
0
 def __init__(self, settings, username, api_key):
     ConchUser.__init__(self)
     self.settings = settings
     self.username = username
     self.api_key = api_key
     self.channelLookup['session'] = SSHSession
Ejemplo n.º 29
0
 def __init__(self, username):
     ConchUser.__init__(self)
     self.username = username
Ejemplo n.º 30
0
 def __init__(self):
     ConchUser.__init__(self)
     self.channelLookup['session'] = SSHSession
Ejemplo n.º 31
0
Archivo: shelless.py Proyecto: cyli/ess
 def __init__(self, root=None):
     ConchUser.__init__(self)
     self.channelLookup["session"] = ShelllessSession
Ejemplo n.º 32
0
 def __init__(self, avatarId):
     ConchUser.__init__(self)
     self.avatarId = avatarId
     self.channelLookup['session'] = session.SSHSession
Ejemplo n.º 33
0
 def __init__(self, avatarId):
     ConchUser.__init__(self)
     self.email, self.pydas, self.url = avatarId
     self.channelLookup['session'] = SSHSession
     self.subsystemLookup.update(
             {'sftp': MidasFileTransferServer})
Ejemplo n.º 34
0
 def requestAvatar(self, avatarId, mind, *interfaces):
     avatar = ConchUser()
     avatar.channelLookup = self.channelLookup
     return (IConchUser, avatar, lambda: None)
Ejemplo n.º 35
0
 def __init__(self, username, datapath):
     ConchUser.__init__(self)
     self.username = username
     self.datapath = datapath
     self.channelLookup["session"] = SSHSession
Ejemplo n.º 36
0
 def requestAvatar(avatar_id, mind, *interfaces):
     user = ConchUser()
     user.channelLookup['session'] = SimpleSession
     return IConchUser, user, lambda: None
Ejemplo n.º 37
0
 def __init__(self, username):
     ConchUser.__init__(self)
     self.channelLookup.update({'session': session.SSHSession})
     self.username = username
     self.listeners = {}