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>
|
||||
<array>
|
||||
<string>uds</string>
|
||||
<string>udss</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
@ -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)
|
||||
|
@ -132,6 +132,9 @@ class RDPFile(object):
|
||||
<integer>{}</integer>
|
||||
</dict>'''.format(self.width, self.height)
|
||||
|
||||
drives = self.redirectDrives and "1" or "0"
|
||||
audioMode = self.redirectAudio and "0" or "2"
|
||||
|
||||
return '''
|
||||
<?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">
|
||||
@ -142,7 +145,7 @@ class RDPFile(object):
|
||||
<key>ApplicationPath</key>
|
||||
<string></string>
|
||||
<key>AudioRedirectionMode</key>
|
||||
<integer>0</integer>
|
||||
<integer>{audioMode}</integer>
|
||||
<key>AuthenticateLevel</key>
|
||||
<integer>0</integer>
|
||||
<key>AutoReconnect</key>
|
||||
@ -166,7 +169,7 @@ class RDPFile(object):
|
||||
<key>DontWarnOnQuit</key>
|
||||
<true/>
|
||||
<key>DriveRedirectionMode</key>
|
||||
<integer>0</integer>
|
||||
<integer>{drives}</integer>
|
||||
<key>FontSmoothing</key>
|
||||
<true/>
|
||||
<key>FullWindowDrag</key>
|
||||
@ -314,6 +317,8 @@ class RDPFile(object):
|
||||
</dict>
|
||||
</plist>'''.format(
|
||||
desktopSize=desktopSize,
|
||||
drives=drives,
|
||||
audioMode=audioMode,
|
||||
host=self.address,
|
||||
domain=self.domain,
|
||||
username=self.username
|
||||
|
@ -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', \'\'\'
|
||||
<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:
|
||||
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']))
|
||||
|
Loading…
Reference in New Issue
Block a user