Exemple #1
0
    def test_connection(self):
        """ Tests if the VNC capability is up, and tries login.
        """
        sessions = {}

        options = {'enabled': 'True', 'port': 0, 'users': {'test': 'test'}}
        cap = vnc.vnc(sessions, options, self.work_dir)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

        client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        client_socket.connect(('127.0.0.1', srv.server_port))

        protocol_version = client_socket.recv(1024)
        self.assertEquals(protocol_version, 'RFB 003.007\n')

        client_socket.send(RFB_VERSION)
        supported_auth_methods = client_socket.recv(1024)
        self.assertEquals(supported_auth_methods, SUPPORTED_AUTH_METHODS)

        client_socket.send(VNC_AUTH)
        challenge = client_socket.recv(1024)

        # Send 16 bytes because server expects them. Don't care what they
        # are
        client_socket.send('\x00' * 16)
        auth_status = client_socket.recv(1024)
        self.assertEquals(auth_status, AUTH_FAILED)
Exemple #2
0
    def test_login(self):
        """Tests if the VNC bee can connect to the VNC capability"""

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

        cap = hive_vnc.vnc(sessions, {'enabled': 'True', 'port': 0}, users, self.work_dir)
        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 = bee_vnc.vnc(beesessions, bee_info)
        current_bee.do_session('127.0.0.1')
        srv.stop()
Exemple #3
0
    def test_login(self):
        """Tests if the VNC bait can connect to the VNC capability"""

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

        cap = hive_vnc.vnc(sessions, options, self.work_dir)
        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',
            'honeypot_id': '1234'
        }
        beesessions = {}

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bait = bee_vnc.vnc(beesessions, bee_info)
        current_bait.start()
        srv.stop()
Exemple #4
0
    def test_connection(self):
        """ Tests if the VNC capability is up, and tries login.
        """
        sessions = {}

        options = {'enabled': 'True', 'port': 0, 'users': {'test': 'test'}}
        cap = vnc.vnc(sessions, options, self.work_dir)
        srv = StreamServer(('0.0.0.0', 0), cap.handle_session)
        srv.start()

        client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        client_socket.connect(('127.0.0.1', srv.server_port))

        protocol_version = client_socket.recv(1024)
        self.assertEquals(protocol_version, 'RFB 003.007\n')

        client_socket.send(RFB_VERSION)
        supported_auth_methods = client_socket.recv(1024)
        self.assertEquals(supported_auth_methods, SUPPORTED_AUTH_METHODS)

        client_socket.send(VNC_AUTH)
        challenge = client_socket.recv(1024)

        # Send 16 bytes because server expects them. Don't care what they
        # are
        client_socket.send('\x00' * 16)
        auth_status = client_socket.recv(1024)
        self.assertEquals(auth_status, AUTH_FAILED)
Exemple #5
0
    def test_login(self):
        """Tests if the VNC bait can connect to the VNC capability"""

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

        cap = hive_vnc.vnc(sessions, options, self.work_dir)
        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',
            'honeypot_id': '1234'
        }
        beesessions = {}

        BaitSession.client_id = 'f51171df-c8f6-4af4-86c0-f4e163cf69e8'
        current_bait = bee_vnc.vnc(beesessions, bee_info)
        current_bait.start()
        srv.stop()