Beispiel #1
0
    def start(self):
        """
            Starts sending client bees to the configured Honeypot.
        """
        logger.info('Starting client.')

        sessions = {}

        # greenlet to consume and maintain data in sessions list
        self.sessions_consumer = Consumer(sessions, self.config, self.my_ip)
        gevent.spawn(self.sessions_consumer.start_handling)

        self.dispatcher_greenlets = []

        for honeypot_id, entry in self.config['baits'].items():
            for b in clientbase.ClientBase.__subclasses__():
                bait_name = b.__name__.lower()
                # if the bait has a entry in the config we consider the bait enabled
                if bait_name in entry:
                    bait_options = entry[bait_name]
                    #bait_session = b(sessions, bait_options)
                    dispatcher = BaitDispatcher(sessions, b, bait_options)
                    dispatcher.start()
                    self.dispatcher_greenlets.append(dispatcher)
                    logger.info('Adding {0} bait'.format(bait_name))
                    logger.debug(
                        'Bait added with options: {0}'.format(bait_options))

        gevent.joinall(self.dispatcher_greenlets)
Beispiel #2
0
    def start(self):
        """
            Starts sending client bees to the configured Honeypot.
        """
        logger.info('Starting client.')

        sessions = {}

        # greenlet to consume and maintain data in sessions list
        self.sessions_consumer = Consumer(sessions, self.config, self.my_ip)
        gevent.spawn(self.sessions_consumer.start_handling)

        self.dispatcher_greenlets = []

        for honeypot_id, entry in self.config['baits'].items():
            for b in clientbase.ClientBase.__subclasses__():
                bait_name = b.__name__.lower()
                # if the bait has a entry in the config we consider the bait enabled
                if bait_name in entry:
                    bait_options = entry[bait_name]
                    #bait_session = b(sessions, bait_options)
                    dispatcher = BaitDispatcher(sessions, b, bait_options)
                    dispatcher.start()
                    self.dispatcher_greenlets.append(dispatcher)
                    logger.info('Adding {0} bait'.format(bait_name))
                    logger.debug('Bait added with options: {0}'.format(bait_options))

        gevent.joinall(self.dispatcher_greenlets)
Beispiel #3
0
    def test_dispatcher(self):
        options =  {
                    'enabled': True,
                    'server': '127.0.0.1',
                    'active_range': '00:00 - 23:59',
                    'sleep_interval': '1',
                    'activation_probability': '1',
                    'username': '******',
                    'password': '******',
                    'port': 8080 }

        dispatcher = BaitDispatcher({}, None, options)

        dispatcher.bait_type = Mock()
        dispatcher_greenlet = Greenlet(dispatcher.start)
        dispatcher_greenlet.start()
        time.sleep(1)
        dispatcher_greenlet.kill()
        dispatcher.bait_type.start.assert_called()
Beispiel #4
0
    def test_dispatcher(self):
        options = {
            'enabled': True,
            'server': '127.0.0.1',
            'active_range': '00:00 - 23:59',
            'sleep_interval': '1',
            'activation_probability': '1',
            'username': '******',
            'password': '******',
            'port': 8080
        }

        dispatcher = BaitDispatcher({}, None, options)

        dispatcher.bait_type = Mock()
        dispatcher_greenlet = Greenlet(dispatcher.start)
        dispatcher_greenlet.start()
        time.sleep(1)
        dispatcher_greenlet.kill()
        dispatcher.bait_type.start.assert_called()
Beispiel #5
0
    def test_dispatcher(self):
        options = {
            "enabled": True,
            "server": "127.0.0.1",
            "active_range": "00:00 - 23:59",
            "sleep_interval": "1",
            "activation_probability": "1",
            "username": "******",
            "password": "******",
            "port": 8080,
        }

        dispatcher = BaitDispatcher(None, options)

        dispatcher.bait_type = Mock()
        dispatcher_greenlet = Greenlet(dispatcher.start)
        dispatcher_greenlet.start()
        time.sleep(1)
        dispatcher_greenlet.kill()
        dispatcher.bait_type.start.assert_called()
Beispiel #6
0
    def start(self):
        """
            Starts sending client bait to the configured Honeypot.
        """
        logger.info('Starting client.')

        self.dispatcher_greenlets = []

        for _, entry in self.config['baits'].items():
            for b in clientbase.ClientBase.__subclasses__():
                bait_name = b.__name__.lower()
                # if the bait has a entry in the config we consider the bait enabled
                if bait_name in entry:
                    bait_options = entry[bait_name]
                    dispatcher = BaitDispatcher(b, bait_options)
                    dispatcher.start()
                    self.dispatcher_greenlets.append(dispatcher)
                    logger.info('Adding {0} bait'.format(bait_name))
                    logger.debug('Bait added with options: {0}'.format(bait_options))

        gevent.joinall(self.dispatcher_greenlets)
Beispiel #7
0
    def test_dispatcher(self):
        options = {
            'enabled': True,
            'server': '127.0.0.1',
            'active_range': '00:00 - 23:59',
            'sleep_interval': '1',
            'activation_probability': '1',
            'username': '******',
            'password': '******',
            'port': 8080}

        dispatcher = BaitDispatcher(Mock(), options)

        dispatcher_greenlet = Greenlet(dispatcher.start)
        dispatcher_greenlet.start()
        gevent.sleep(2)
        dispatcher_greenlet.kill()