Ejemplo n.º 1
0
    def connectionLost(self, reason):
        """
        Fires on pre-authentication disconnects
        """
        self.setTimeout(None)
        TelnetTransport.connectionLost(self, reason)

        # close transport on backend
        if self.client and self.client.transport:
            self.client.transport.loseConnection()

        # signal that we're closing to the handler
        self.telnetHandler.close()

        if self.pool_interface:
            # free VM from pool (VM was used if auth was performed successfully)
            self.pool_interface.send_vm_free(self.telnetHandler.authDone)

            # close transport connection to pool
            self.pool_interface.transport.loseConnection()

        if self.startTime is not None:  # startTime is not set when auth fails
            duration = time.time() - self.startTime
            log.msg(eventid='cowrie.session.closed',
                    format='Connection lost after %(duration)d seconds',
                    duration=duration)
Ejemplo n.º 2
0
 def connectionLost(self, reason):
     """
     Fires on pre-authentication disconnects
     """
     self.setTimeout(None)
     TelnetTransport.connectionLost(self, reason)
     duration = time.time() - self.startTime
     log.msg(eventid='cowrie.session.closed',
             format='Connection lost after %(duration)d seconds',
             duration=duration)
Ejemplo n.º 3
0
 def connectionLost(self, reason):
     """
     Fires on pre-authentication disconnects
     """
     self.setTimeout(None)
     TelnetTransport.connectionLost(self, reason)
     duration = time.time() - self.startTime
     log.msg(eventid='cowrie.session.closed',
         format='Connection lost after %(duration)d seconds',
         duration=duration)
Ejemplo n.º 4
0
    def connectionLost(self, reason):
        """
        Fires on pre-authentication disconnects
        """
        self.setTimeout(None)
        TelnetTransport.connectionLost(self, reason)

        # close transport on backend
        self.client.transport.loseConnection()

        # signal that we're closing to the handler
        self.telnetHandler.close()

        duration = time.time() - self.startTime
        log.msg(eventid='cowrie.session.closed',
                format='Connection lost after %(duration)d seconds',
                duration=duration)
Ejemplo n.º 5
0
 def connectionLost(self, reason):
     self.factory.open_channels.remove(self.protocol)
     TelnetTransport.connectionLost(self, reason)