Пример #1
0
    def buildProtocol(self, addr):
        proto = SSHFactory.buildProtocol(self, addr)
        proto.factory = self

        random_color = random.choice(self.colors.keys())
        proto.color = self.colors.get(random_color)
        return proto
Пример #2
0
 def buildProtocol(self, address):
     transport = SSHFactory.buildProtocol(self, address)
     transport._realConnectionLost = transport.connectionLost
     transport.connectionLost = (
         lambda reason: self.connectionLost(transport, reason)
     )
     #notify(events.UserConnected(transport, address))
     print('notify user connected %s %s' % (transport, address))
     return transport
Пример #3
0
    def buildProtocol(self, addr):
        """
         Pending: Do IP based authentication here
         for example: assert addr.host=='127.0.0.1'
        """

        # protocol is wisted.conch.ssh.transport.SSHServerTransport instance
        protocol = SSHFactory.buildProtocol(self, addr)

        return protocol
Пример #4
0
    def buildProtocol(self, address):
        """Build an SSH protocol instance, logging the event.

        The protocol object we return is slightly modified so that we can hook
        into the 'connectionLost' event and log the disconnection.
        """
        transport = SSHFactory.buildProtocol(self, address)
        transport._realConnectionLost = transport.connectionLost
        transport.connectionLost = (
            lambda reason: self.connectionLost(transport, reason))
        notify(events.UserConnected(transport, address))
        return transport
Пример #5
0
    def buildProtocol(self, address):
        """Build an SSH protocol instance, logging the event.

        The protocol object we return is slightly modified so that we can hook
        into the 'connectionLost' event and log the disconnection.
        """
        transport = SSHFactory.buildProtocol(self, address)
        transport._realConnectionLost = transport.connectionLost
        transport.connectionLost = (
            lambda reason: self.connectionLost(transport, reason))
        notify(events.UserConnected(transport, address))
        return transport
Пример #6
0
 def buildProtocol(self, addr):
     self.protocol = SSHFactory.buildProtocol(self, addr)
     return self.protocol
 def buildProtocol(self, addr):
     self.protocol = SSHFactory.buildProtocol(self, addr)
     return self.protocol