Beispiel #1
0
    def test_validate_senses(self):

        options = {
            'enabled': 'True',
            'port': 0,
            'protocol_specific_data': {
                'max_attempts': 3
            },
            'users': {
                'test': 'test'
            }
        }

        cap = honeypot_telnet.Telnet(options, self.work_dir)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

        bait_info = {
            'timing': 'regular',
            'username': '******',
            'password': '******',
            'port': srv.server_port,
            'server': '127.0.0.1'
        }

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bee = bee_telnet.Telnet(bait_info)
        for s in current_bee.senses:
            sense = getattr(current_bee, s)
            self.assertTrue(callable(sense))
Beispiel #2
0
    def test_command_list(self):

        options = {
            'enabled': 'True',
            'port': 0,
            'protocol_specific_data': {
                'max_attempts': 3
            },
            'users': {
                'test': 'test'
            }
        }

        cap = honeypot_telnet.Telnet(options, self.work_dir)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

        bait_info = {
            'timing': 'regular',
            'username': '******',
            'password': '******',
            'port': srv.server_port,
            'server': '127.0.0.1',
            'honeypot_id': '1234'
        }

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bee = bee_telnet.Telnet(bait_info)

        current_bee.connect()
        current_bee.login(bait_info['username'], bait_info['password'])

        resp = current_bee.ls()
        self.assertTrue('var' in resp)
Beispiel #3
0
    def test_login(self):
        """Tests if the Telnet bait can Login to the Telnet capability"""

        options = {
            'enabled': 'True',
            'port': 0,
            'protocol_specific_data': {
                'max_attempts': 3
            },
            'users': {
                'test': 'test'
            }
        }
        cap = honeypot_telnet.Telnet(options, self.work_dir)

        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

        bait_info = {
            'timing': 'regular',
            'username': '******',
            'password': '******',
            'port': srv.server_port,
            'server': '127.0.0.1'
        }

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bee = bee_telnet.Telnet(bait_info)
        current_bee.connect()
        current_bee.login(bait_info['username'], bait_info['password'])
        srv.stop()
Beispiel #4
0
    def test_command_cd(self):

        options = {
            'enabled': 'True',
            'port': 0,
            'protocol_specific_data': {
                'max_attempts': 3
            },
            'users': {
                'test': 'test'
            }
        }
        cap = honeypot_telnet.Telnet(options, self.work_dir)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

        bait_info = {
            'timing': 'regular',
            'username': '******',
            'password': '******',
            'port': srv.server_port,
            'server': '127.0.0.1'
        }

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bait = bee_telnet.Telnet(bait_info)

        current_bait.connect()
        current_bait.login(bait_info['username'], bait_info['password'])

        # Command: cd
        self.assertEquals('/', current_bait.state['working_dir'])
        current_bait.cd('/var')
        self.assertEquals('/var', current_bait.state['working_dir'])