diff --git a/client/notes/macosx/Info.plist b/client/notes/macosx/Info.plist index a8aac606..140f5a51 100644 --- a/client/notes/macosx/Info.plist +++ b/client/notes/macosx/Info.plist @@ -45,6 +45,7 @@ CFBundleURLSchemes uds + udss diff --git a/client/src/UDSClient.py b/client/src/UDSClient.py index a367d813..70a94076 100644 --- a/client/src/UDSClient.py +++ b/client/src/UDSClient.py @@ -168,8 +168,8 @@ if __name__ == "__main__": sys.exit(1) # Setup REST api endpoint - # RestRequest.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host) - RestRequest.restApiUrl = 'https://172.27.0.1/rest/client' + RestRequest.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host) + # RestRequest.restApiUrl = 'https://172.27.0.1/rest/client' try: win = UDSClient() @@ -178,18 +178,25 @@ if __name__ == "__main__": exitVal = app.exec_() - win.showMinimized() # This is a top most window, minimize to bar + win.showMinimized() # This is a top most window, minimize to bar because it is not closed in fact until app exit tools.waitForTasks() - time.sleep(3) - tools.unlinkFiles() - - tools.execBeforeExit() - sys.exit(exitVal) except Exception as e: QtGui.QMessageBox.critical(None, 'Error', six.text_type(e), QtGui.QMessageBox.Ok) + time.sleep(3) + try: + tools.unlinkFiles() + except Exception: + pass + + try: + tools.execBeforeExit() + except Exception: + pass + + # Build base REST # v = RestRequest('', done) diff --git a/server/src/uds/transports/RDP/RDPFile.py b/server/src/uds/transports/RDP/RDPFile.py index 2f6f65b7..0314ebcb 100644 --- a/server/src/uds/transports/RDP/RDPFile.py +++ b/server/src/uds/transports/RDP/RDPFile.py @@ -132,6 +132,9 @@ class RDPFile(object): {} '''.format(self.width, self.height) + drives = self.redirectDrives and "1" or "0" + audioMode = self.redirectAudio and "0" or "2" + return ''' @@ -142,7 +145,7 @@ class RDPFile(object): ApplicationPath AudioRedirectionMode - 0 + {audioMode} AuthenticateLevel 0 AutoReconnect @@ -166,7 +169,7 @@ class RDPFile(object): DontWarnOnQuit DriveRedirectionMode - 0 + {drives} FontSmoothing FullWindowDrag @@ -314,6 +317,8 @@ class RDPFile(object): '''.format( desktopSize=desktopSize, + drives=drives, + audioMode=audioMode, host=self.address, domain=self.domain, username=self.username diff --git a/server/src/uds/transports/RDP/RDPTransport.py b/server/src/uds/transports/RDP/RDPTransport.py index fa4e5132..e49451be 100644 --- a/server/src/uds/transports/RDP/RDPTransport.py +++ b/server/src/uds/transports/RDP/RDPTransport.py @@ -123,6 +123,7 @@ from __future__ import unicode_literals from PyQt4 import QtCore, QtGui import subprocess +import os from uds import tools @@ -130,8 +131,19 @@ import six file = \'\'\'{file}\'\'\' +# First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one) + + filename = tools.saveTempFile(file) -executable = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection' +msrdc = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection' +cord = "/Applications/CoRD.app/Contents/MacOS/CoRD" + +if os.path.isfile(msrdc): + executable = msrdc +elif os.path.isfile(cord): + executable = cord +else: + executable = None def onExit(): import subprocess @@ -141,26 +153,50 @@ def onExit(): '-s', 'Remote Desktop Connection 2 Password for {ip}', ]) -try: - subprocess.call(['security', - 'add-generic-password', - '-w', '{password}', - '-U', - '-a', '{username}', - '-s', 'Remote Desktop Connection 2 Password for {ip}', - ]) - # Call but do not wait for exit - tools.addTaskToWait(subprocess.Popen([executable, filename])) - tools.addExecBeforeExit(onExit) +if executable is None: + QtGui.QMessageBox.critical(parent, 'Notice', \'\'\' +

Microsoft Remote Desktop Connection not found

+

In order to connect to UDS RDP Sessions, you need to have at least one of the following:

+

+

If both apps are installed, Remote Desktop Connection will be used as first option

+ +\'\'\', QtGui.QMessageBox.Ok) +elif executable == msrdc: + try: + subprocess.call(['security', + 'add-generic-password', + '-w', '{password}', + '-U', + '-a', '{username}', + '-s', 'Remote Desktop Connection 2 Password for {ip}', + '-T', '/Applications/Remote Desktop Connection.app', + ]) + # Call but do not wait for exit + tools.addTaskToWait(subprocess.Popen([executable, filename])) + tools.addExecBeforeExit(onExit) + + tools.addFileToUnlink(filename) + except Exception as e: + QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok) +else: # CoRD + pass - tools.addFileToUnlink(filename) -except Exception as e: - QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok) '''.format(os=data['os'], file=r.get(), password=data['password'], username=username, - ip=data['ip'] + ip=data['ip'], + this_server=data['this_server'] ) def getUDSTransportScript(self, userService, transport, ip, os, user, password, request): @@ -191,7 +227,8 @@ except Exception as e: 'compression': True, 'wallpaper': self.wallpaper.isTrue(), 'multimon': self.multimon.isTrue(), - 'fullScreen': width == -1 or height == -1 + 'fullScreen': width == -1 or height == -1, + 'this_server': request.build_absolute_uri('/') } logger.debug('Detected os: {}'.format(data['os']))