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 offershell(self):
        log.msg("OfferShell command received.")

        ticket = tickets.newTicket()
        self.factory.tickets[ticket] = (self.avatar.conn, self)
        self.ticket = ticket
        log.msg("Shell slave client accepted and assigned ticket %s" % (ticket,))
        return {'ticket' : ticket}
Esempio n. 3
0
    def offershell(self):
        log.msg("OfferShell command received.")

        ticket = tickets.newTicket()
        self.factory.tickets[ticket] = (self.avatar.conn, self)
        self.ticket = ticket
        log.msg("Shell slave client accepted and assigned ticket %s" %
                (ticket, ))
        return {'ticket': ticket}
Esempio n. 4
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