diff --git a/client/full/linux/debian/changelog b/client/full/linux/debian/changelog index f9d5a1d27..63536da9a 100644 --- a/client/full/linux/debian/changelog +++ b/client/full/linux/debian/changelog @@ -1,3 +1,9 @@ +udsclient (2.2.0) stable; urgency=medium + + * Updated release + + -- Adolfo Gómez García Thu, 27 Aug 2017 14:18:18 +0200 + udsclient (2.1.0) stable; urgency=medium * Updated release diff --git a/client/full/linux/debian/files b/client/full/linux/debian/files index 966f1899d..c47b260a9 100644 --- a/client/full/linux/debian/files +++ b/client/full/linux/debian/files @@ -1,2 +1,2 @@ -udsclient_2.1.0_all.deb admin optional -udsclient_2.1.0_amd64.buildinfo admin optional +udsclient_2.2.0_all.deb admin optional +udsclient_2.2.0_amd64.buildinfo admin optional diff --git a/client/full/src/UDSClient.py b/client/full/src/UDSClient.py index aa2685fe6..c8b9fe516 100755 --- a/client/full/src/UDSClient.py +++ b/client/full/src/UDSClient.py @@ -49,7 +49,8 @@ import six from UDSWindow import Ui_MainWindow -OLD_METHOD_VERSION = '2.1.0' +# Server before this version uses "unsigned" scripts +OLD_METHOD_VERSION = '2.4.0' class RetryException(Exception): pass @@ -269,7 +270,6 @@ def approveHost(host, parentWindow=None): settings.endGroup() return approved - if __name__ == "__main__": logger.debug('Initializing connector') # Initialize app diff --git a/client/thin/src/UDSClient.py b/client/thin/src/UDSClient.py index 25da9c5be..8cc3a1d2f 100644 --- a/client/thin/src/UDSClient.py +++ b/client/thin/src/UDSClient.py @@ -74,14 +74,13 @@ def approveHost(host): except Exception: logger.warn('Got exception writing to {}'.format(hostsFile)) - return approved -def getWithRetry(rest, url): +def getWithRetry(rest, url, params=None): while True: try: - res = rest.get(url) + res = rest.get(url, params) return res except RetryException as e: if ui.question('Service not available', '{}\nPlease, wait a minute and press "OK" to retry, or CANCEL to abort') is True: @@ -125,16 +124,38 @@ if __name__ == "__main__": try: res = getWithRetry(rest, '') + logger.debug('Got information {}'.format(res)) + if res['requiredVersion'] > VERSION: - ui.message("New UDS Client available", "A new uds version is needed in order to access this version of UDS. A browser will be openend for this download.") + ui.message("New UDS Client available", "A new uds version is needed in order to access this version of UDS. A browser will be opened for this download.") webbrowser.open(res['downloadUrl']) sys.exit(1) - # Now get ticket res = getWithRetry(rest, '/{}/{}'.format(ticket, scrambler), params={'hostname': tools.getHostName(), 'version': VERSION}) + script = res.decode('base64').decode('bz2') + + logger.debug('Script: {}'.format(script)) + + six.exec_(script, globals(), {'parent': None}) except Exception as e: error = 'ERROR: {}'.format(e) logger.error(error) ui.message('Error', error) sys.exit(2) + + # Finalize + try: + tools.waitForTasks() + except Exception: + pass + + try: + tools.unlinkFiles() + except Exception: + pass + + try: + tools.execBeforeExit() + except Exception: + pass diff --git a/client/thin/src/uds/rest.py b/client/thin/src/uds/rest.py index f062571de..df87f663d 100644 --- a/client/thin/src/uds/rest.py +++ b/client/thin/src/uds/rest.py @@ -37,7 +37,7 @@ from . import VERSION import json import six -import urllib +import osDetector from .log import logger @@ -55,16 +55,17 @@ class RestRequest(object): self.host = host self.ssl = ssl - self.restApiUrl = RestRequest('{}://{}/rest/client'.format(['http', 'https'][ssl], host)) + self.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host) def get(self, url, params=None): url = self.restApiUrl + url if params is not None: - url += '?' + '&'.join('{}={}'.format(k, urllib.quote(six.text_type(v).encode('utf8'))) for k, v in params.iteritems()) + url += '?' + '&'.join('{}={}'.format(k, six.moves.urllib.parse.quote(six.text_type(v).encode('utf8'))) for k, v in params.iteritems()) # @UndefinedVariable logger.debug('Requesting {}'.format(url)) + try: - r = requests.get(url, headers={'Content-type': 'application/json'}) + r = requests.get(url, headers={'Content-type': 'application/json', 'User-Agent': osDetector.getOs() + " - UDS Connector " + VERSION }) except requests.exceptions.ConnectionError as e: raise Exception('Error connecting to UDS Server at {}'.format(self.restApiUrl[0:-11])) diff --git a/client/thin/src/uds/ui/__init__.py b/client/thin/src/uds/ui/__init__.py index 08e0b50ed..5877eae66 100644 --- a/client/thin/src/uds/ui/__init__.py +++ b/client/thin/src/uds/ui/__init__.py @@ -34,7 +34,7 @@ from __future__ import unicode_literals try: import gtkui as theUI except Exception: - import consoleui as theUI + import consoleui as theUI # @Reimport def message(title, message): theUI.message(title, message) diff --git a/client/thin/src/uds/ui/consoleui.py b/client/thin/src/uds/ui/consoleui.py index 03c1c3c6b..9660db64c 100644 --- a/client/thin/src/uds/ui/consoleui.py +++ b/client/thin/src/uds/ui/consoleui.py @@ -31,11 +31,19 @@ ''' from __future__ import unicode_literals import sys +import time from uds.log import logger +counter = 0 + def message(title, message): sys.stderr.write("** {} **\n {}\n".format(title, message)) def question(title, message): - sys.stderr.write("** {} **\n{}\nReturned YES\n".format(title, message)) + global counter + if counter > 100: # 5 minutes + return False + counter += 1 + sys.stderr.write("** {} **\n{}\nReturning YES in 3 seconds. (counter is {})\n".format(title, message, counter)) + time.sleep(3) # Wait 3 seconds before returning return True diff --git a/client/thin/thinstation/README.txt b/client/thin/thinstation/README.txt index 07e96ec04..d72091831 100644 --- a/client/thin/thinstation/README.txt +++ b/client/thin/thinstation/README.txt @@ -1,10 +1,11 @@ Steps: -1.- Copy the folder "udsclient" to /build/packages inside the thinstation build environment -2.- enter the chroot of thinstation -3.- go to the udsclient folder (/build/packages/udsclient) -4.- Execute "build.sh" -5.- Edit the file /build/build.conf, and add this line: +1.- If building from repository, full copy (recursive) the "src" folder of "udsclient/thin" inside the "udsclient" folder. If building from the .tar.gz, simply ignor4e this step +2.- Copy the folder "udsclient" to /build/packages inside the thinstation build environment +3.- enter the chroot of thinstation +4.- go to the udsclient folder (/build/packages/udsclient) +5.- Execute "build.sh" +6.- Edit the file /build/build.conf, and add this line: package udsclient -6.- Execute the build process +7.- Execute the build process Ready!!! diff --git a/server/src/uds/services/PhysicalMachines/IPMachineDeployed.py b/server/src/uds/services/PhysicalMachines/IPMachineDeployed.py index a8f96d87b..873194815 100644 --- a/server/src/uds/services/PhysicalMachines/IPMachineDeployed.py +++ b/server/src/uds/services/PhysicalMachines/IPMachineDeployed.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2012 Virtual Cable S.L. +# Copyright (c) 2016 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,6 +30,7 @@ ''' @author: Adolfo Gómez, dkmaster at dkmon dot com ''' +from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from uds.core import services diff --git a/server/src/uds/transports/HTML5RDP/HTML5RDP.py b/server/src/uds/transports/HTML5RDP/HTML5RDP.py index 03df10611..b8484e87d 100644 --- a/server/src/uds/transports/HTML5RDP/HTML5RDP.py +++ b/server/src/uds/transports/HTML5RDP/HTML5RDP.py @@ -78,7 +78,7 @@ class HTML5RDPTransport(Transport): smooth = gui.CheckBoxField(label=_('Font Smoothing'), order=23, tooltip=_('If checked, fonts smoothing will be allowed (windows clients only)'), tab=gui.PARAMETERS_TAB) enableAudio = gui.CheckBoxField(label=_('Enable Audio'), order=24, tooltip=_('If checked, the audio will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB) enablePrinting = gui.CheckBoxField(label=_('Enable Printing'), order=25, tooltip=_('If checked, the printing will be redirected to client (if client browser supports it)'), tab=gui.PARAMETERS_TAB) - # enableFileSharing = gui.CheckBoxField(label=_('Enable File Sharing'), order=8, tooltip=_('If checked, the user will be able to upload/download files (if client browser supports it)'), tab=gui.PARAMETERS_TAB) + enableFileSharing = gui.CheckBoxField(label=_('Enable File Sharing'), order=8, tooltip=_('If checked, the user will be able to upload/download files (if client browser supports it)'), tab=gui.PARAMETERS_TAB) serverLayout = gui.ChoiceField(order=26, label=_('Layout'), tooltip=_('Keyboards Layout of server'), @@ -188,8 +188,8 @@ class HTML5RDPTransport(Transport): 'create-drive-path': 'true' } - # if self.enableFileSharing.isTrue(): - # params['enable-drive'] = 'true' + if self.enableFileSharing.isTrue(): + params['enable-drive'] = 'true' if self.serverLayout.value != '-': params['server-layout'] = self.serverLayout.value diff --git a/server/src/uds/transports/RDP/RDPFile.py b/server/src/uds/transports/RDP/RDPFile.py index b002b56af..059dbcadc 100644 --- a/server/src/uds/transports/RDP/RDPFile.py +++ b/server/src/uds/transports/RDP/RDPFile.py @@ -40,7 +40,7 @@ from uds.core.util import OsDetector import six import os -__updated__ = '2017-07-06' +__updated__ = '2017-07-26' class RDPFile(object): @@ -95,7 +95,7 @@ class RDPFile(object): Parameters for xfreerdp >= 1.1.0 with self rdp description Note that server is not added ''' - params = ['/clipboard', '/t:UDS-Connection', '/cert-ignore', '/sec:rdp'] + params = ['/clipboard', '/t:UDS-Connection', '/cert-ignore'] # , '/sec:rdp'] if self.redirectSmartcards and self.smartcardString not in (None, ''): params.append('/smartcard:{}'.format(self.smartcardString)) diff --git a/server/src/uds/transports/RDP/RDPTransport.py b/server/src/uds/transports/RDP/RDPTransport.py index 2287bf2ba..4a8ac2f50 100644 --- a/server/src/uds/transports/RDP/RDPTransport.py +++ b/server/src/uds/transports/RDP/RDPTransport.py @@ -44,7 +44,7 @@ logger = logging.getLogger(__name__) READY_CACHE_TIMEOUT = 30 -__updated__ = '2017-06-05' +__updated__ = '2017-08-02' class RDPTransport(BaseRDPTransport): @@ -134,10 +134,11 @@ class RDPTransport(BaseRDPTransport): OsDetector.Linux: 'linux', OsDetector.Macintosh: 'macosx' - }.get(os['OS']) + }.get(m.os) if os is None: - return super(self.__class__, self).getUDSTransportScript(userService, transport, ip, os, user, password, request) + logger.ERROR('Os not detected for RDP Transport: {}'.format(request.META.get('HTTP_USER_AGENT', 'Unknown'))) + return super(RDPTransport, self).getUDSTransportScript(userService, transport, ip, os, user, password, request) sp = { 'password': password, diff --git a/server/src/uds/transports/RDP/scripts/macosx/direct.py b/server/src/uds/transports/RDP/scripts/macosx/direct.py index 1ec289311..654b2fbcc 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/direct.py +++ b/server/src/uds/transports/RDP/scripts/macosx/direct.py @@ -11,9 +11,12 @@ from uds import tools # @UnresolvedImport import six +theFile = '''{m.r.as_file}''' + # First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one) +filename = tools.saveTempFile(theFile) msrdc = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection' cord = "/Applications/CoRD.app/Contents/MacOS/CoRD"