forked from shaba/openuds
Advancing on Mac OS RDP TRansport and a couple minor fixes to UDS Plugin
This commit is contained in:
parent
c5138dbc9c
commit
2f655dce16
@ -45,6 +45,7 @@
|
|||||||
<key>CFBundleURLSchemes</key>
|
<key>CFBundleURLSchemes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>uds</string>
|
<string>uds</string>
|
||||||
|
<string>udss</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
@ -168,8 +168,8 @@ if __name__ == "__main__":
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Setup REST api endpoint
|
# Setup REST api endpoint
|
||||||
# RestRequest.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host)
|
RestRequest.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host)
|
||||||
RestRequest.restApiUrl = 'https://172.27.0.1/rest/client'
|
# RestRequest.restApiUrl = 'https://172.27.0.1/rest/client'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
win = UDSClient()
|
win = UDSClient()
|
||||||
@ -178,18 +178,25 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
exitVal = app.exec_()
|
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()
|
tools.waitForTasks()
|
||||||
|
|
||||||
time.sleep(3)
|
|
||||||
tools.unlinkFiles()
|
|
||||||
|
|
||||||
tools.execBeforeExit()
|
|
||||||
|
|
||||||
sys.exit(exitVal)
|
sys.exit(exitVal)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QtGui.QMessageBox.critical(None, 'Error', six.text_type(e), QtGui.QMessageBox.Ok)
|
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
|
# Build base REST
|
||||||
|
|
||||||
# v = RestRequest('', done)
|
# v = RestRequest('', done)
|
||||||
|
@ -132,6 +132,9 @@ class RDPFile(object):
|
|||||||
<integer>{}</integer>
|
<integer>{}</integer>
|
||||||
</dict>'''.format(self.width, self.height)
|
</dict>'''.format(self.width, self.height)
|
||||||
|
|
||||||
|
drives = self.redirectDrives and "1" or "0"
|
||||||
|
audioMode = self.redirectAudio and "0" or "2"
|
||||||
|
|
||||||
return '''
|
return '''
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
@ -142,7 +145,7 @@ class RDPFile(object):
|
|||||||
<key>ApplicationPath</key>
|
<key>ApplicationPath</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>AudioRedirectionMode</key>
|
<key>AudioRedirectionMode</key>
|
||||||
<integer>0</integer>
|
<integer>{audioMode}</integer>
|
||||||
<key>AuthenticateLevel</key>
|
<key>AuthenticateLevel</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
<key>AutoReconnect</key>
|
<key>AutoReconnect</key>
|
||||||
@ -166,7 +169,7 @@ class RDPFile(object):
|
|||||||
<key>DontWarnOnQuit</key>
|
<key>DontWarnOnQuit</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>DriveRedirectionMode</key>
|
<key>DriveRedirectionMode</key>
|
||||||
<integer>0</integer>
|
<integer>{drives}</integer>
|
||||||
<key>FontSmoothing</key>
|
<key>FontSmoothing</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>FullWindowDrag</key>
|
<key>FullWindowDrag</key>
|
||||||
@ -314,6 +317,8 @@ class RDPFile(object):
|
|||||||
</dict>
|
</dict>
|
||||||
</plist>'''.format(
|
</plist>'''.format(
|
||||||
desktopSize=desktopSize,
|
desktopSize=desktopSize,
|
||||||
|
drives=drives,
|
||||||
|
audioMode=audioMode,
|
||||||
host=self.address,
|
host=self.address,
|
||||||
domain=self.domain,
|
domain=self.domain,
|
||||||
username=self.username
|
username=self.username
|
||||||
|
@ -123,6 +123,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import os
|
||||||
|
|
||||||
from uds import tools
|
from uds import tools
|
||||||
|
|
||||||
@ -130,8 +131,19 @@ import six
|
|||||||
|
|
||||||
file = \'\'\'{file}\'\'\'
|
file = \'\'\'{file}\'\'\'
|
||||||
|
|
||||||
|
# First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one)
|
||||||
|
|
||||||
|
|
||||||
filename = tools.saveTempFile(file)
|
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():
|
def onExit():
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -141,6 +153,25 @@ def onExit():
|
|||||||
'-s', 'Remote Desktop Connection 2 Password for {ip}',
|
'-s', 'Remote Desktop Connection 2 Password for {ip}',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if executable is None:
|
||||||
|
QtGui.QMessageBox.critical(parent, 'Notice', \'\'\'
|
||||||
|
<p><b>Microsoft Remote Desktop Connection not found</b></p>
|
||||||
|
<p>In order to connect to UDS RDP Sessions, you need to have at least one of the following:<p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<p><b>Microsoft Remote Desktop Connection version 2.</b> (Recommended)</p>
|
||||||
|
<p>You can get it from <a href="http://www.microsoft.com/es-es/download/details.aspx?id=18140">this link</a></p>
|
||||||
|
<p>Remember that you need to use the One from the Microsoft site (the link provided), not the one from the AppStore</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><b>CoRD</b> (A bit unstable from 10.7 onwards)</p>
|
||||||
|
<p>You can get it from <a href="{this_server}static/other/CoRD.pkg">this link</a></p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>If both apps are installed, Remote Desktop Connection will be used as first option</p>
|
||||||
|
|
||||||
|
\'\'\', QtGui.QMessageBox.Ok)
|
||||||
|
elif executable == msrdc:
|
||||||
try:
|
try:
|
||||||
subprocess.call(['security',
|
subprocess.call(['security',
|
||||||
'add-generic-password',
|
'add-generic-password',
|
||||||
@ -148,6 +179,7 @@ try:
|
|||||||
'-U',
|
'-U',
|
||||||
'-a', '{username}',
|
'-a', '{username}',
|
||||||
'-s', 'Remote Desktop Connection 2 Password for {ip}',
|
'-s', 'Remote Desktop Connection 2 Password for {ip}',
|
||||||
|
'-T', '/Applications/Remote Desktop Connection.app',
|
||||||
])
|
])
|
||||||
# Call but do not wait for exit
|
# Call but do not wait for exit
|
||||||
tools.addTaskToWait(subprocess.Popen([executable, filename]))
|
tools.addTaskToWait(subprocess.Popen([executable, filename]))
|
||||||
@ -156,11 +188,15 @@ try:
|
|||||||
tools.addFileToUnlink(filename)
|
tools.addFileToUnlink(filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok)
|
||||||
|
else: # CoRD
|
||||||
|
pass
|
||||||
|
|
||||||
'''.format(os=data['os'],
|
'''.format(os=data['os'],
|
||||||
file=r.get(),
|
file=r.get(),
|
||||||
password=data['password'],
|
password=data['password'],
|
||||||
username=username,
|
username=username,
|
||||||
ip=data['ip']
|
ip=data['ip'],
|
||||||
|
this_server=data['this_server']
|
||||||
)
|
)
|
||||||
|
|
||||||
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
|
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
|
||||||
@ -191,7 +227,8 @@ except Exception as e:
|
|||||||
'compression': True,
|
'compression': True,
|
||||||
'wallpaper': self.wallpaper.isTrue(),
|
'wallpaper': self.wallpaper.isTrue(),
|
||||||
'multimon': self.multimon.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']))
|
logger.debug('Detected os: {}'.format(data['os']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user