Exemplo n.º 1
0
    def test_command_echo(self):

        sessions = {}
        users = {'test': BaitUser('test', 'test')}
        authenticator = Authenticator(users)
        Session.authenticator = authenticator

        cap = honeypot_ssh.SSH(sessions, {'enabled': 'True', 'port': 0, 'max_attempts': 3}, users,
                           self.work_dir, self.key)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

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

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bee = client_ssh.ssh(beesessions, bee_info)
        current_bee.connect_login()

        resp = current_bee.echo('just testing!')
        self.assertTrue('just testing!' in resp)
Exemplo n.º 2
0
    def test_logout(self):
        """Tests if the SSH bee can Logout from the SSH capability"""

        sessions = {}
        users = {'test': BaitUser('test', 'test')}
        authenticator = Authenticator(users)
        Session.authenticator = authenticator

        cap = honeypot_ssh.SSH(sessions, {'enabled': 'True', 'port': 0, 'max_attempts': 3}, users,
                           self.work_dir, self.key)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

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

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bee = client_ssh.ssh(beesessions, bee_info)
        current_bee.connect_login()
        current_bee.logout()
        srv.stop()
Exemplo n.º 3
0
    def test_validate_senses(self):
        sessions = {}
        users = {'test': BaitUser('test', 'test')}
        authenticator = Authenticator(users)
        Session.authenticator = authenticator

        cap = honeypot_ssh.SSH(sessions, {'enabled': 'True', 'port': 0, 'max_attempts': 3}, users,
                           self.work_dir, self.key)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

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

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bee = client_ssh.ssh(beesessions, bee_info)
        for s in current_bee.senses:
            sense = getattr(current_bee, s)
            self.assertTrue(callable(sense))