Пример #1
0
    def requestAvatar(self, avatarId, mind, *interfaces):
        """
        """

        # if mind in self.servers:
        #    log.msg( "Using existing server for mind %s" % mind )
        #    for i in self.servers[mind].avatars:
        #	log.msg( "attached avatar: %s" % repr(i) )
        #else:
        #    log.msg( "Starting new server for mind %s" % mind )
        #    self.servers[mind] = server.CowrieServer(self.cfg)

        # for i in list(self.servers.keys()):
        #    log.msg( "REFCOUNT: key: %s, refcount %d" % ( i, sys.getrefcount(self.servers[i])))
        #    log.msg( "Refer: %s" % repr( gc.get_referrers(self.servers[i])))

        if conchinterfaces.IConchUser in interfaces:
            serv = server.CowrieServer(self)
            user = avatar.CowrieUser(avatarId, serv)
            return interfaces[0], user, user.logout
        elif ITelnetProtocol in interfaces:
            serv = server.CowrieServer(self)
            user = session.HoneyPotTelnetSession(avatarId, serv)
            return interfaces[0], user, user.logout

        log.msg('No supported interfaces found.')
        # TODO: this exception doesn't raise for a reason I don't understand
        raise NotImplementedError("No supported interfaces found.")
Пример #2
0
    def requestAvatar(self, avatarId, mind, *interfaces):

        if mind in self.servers:
            pass
        else:
            self.servers[mind] = server.CowrieServer(self.cfg)

        if conchinterfaces.IConchUser in interfaces:
            return interfaces[0], \
                ssh.HoneyPotAvatar(avatarId, self.servers[mind]), lambda: None
        else:
            raise Exception, "No supported interfaces found."
Пример #3
0
    def requestAvatar(self, avatarId, mind, *interfaces):

        # if mind in self.servers:
        #    log.msg( "Using existing server for mind %s" % mind )
        #    for i in self.servers[mind].avatars:
        #	log.msg( "attached avatar: %s" % repr(i) )
        #else:
        #    log.msg( "Starting new server for mind %s" % mind )
        #    self.servers[mind] = server.CowrieServer(self.cfg)

        # for i in list(self.servers.keys()):
        #    log.msg( "REFCOUNT: key: %s, refcount %d" % ( i, sys.getrefcount(self.servers[i])))
        #    log.msg( "Refer: %s" % repr( gc.get_referrers(self.servers[i])))

        if conchinterfaces.IConchUser in interfaces:
            return interfaces[0], \
                ssh.CowrieUser(avatarId, server.CowrieServer(self.cfg)), lambda:None
        else:
            raise Exception("No supported interfaces found.")