1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

clientfix

This commit is contained in:
Adolfo Gómez García 2019-04-23 14:39:06 +02:00
parent b248a284bb
commit 842595be95
4 changed files with 12 additions and 9 deletions

View File

@ -194,7 +194,7 @@ class UDSClient(QtGui.QMainWindow):
if tools.verifySignature(script, signature) is False:
logger.error('Signature is invalid')
# raise Exception('Invalid UDS code signature. Please, report to administrator')
raise Exception('Invalid UDS code signature. Please, report to administrator')
self.stopAnim()

View File

@ -54,7 +54,7 @@ import logging
logger = logging.getLogger(__name__)
CLIENT_VERSION = UDS_VERSION
REQUIRED_CLIENT_VERSION = '2.5.0'
REQUIRED_CLIENT_VERSION = '3.0.0'
# Enclosed methods under /actor path
@ -150,7 +150,7 @@ class Client(Handler):
return Client.result(result={
'script': transportScript,
'signature': signature, # It is already on base64
'params': json.dumps(params).encode('bz2').encode('base64'),
'params': encoders.encode(encoders.encode(json.dumps(params), 'bz2'), 'base64', asText=True),
})
except ServiceNotReadyError as e:
# Refresh ticket and make this retrayable

View File

@ -159,6 +159,9 @@ class RDPTransport(BaseRDPTransport):
sp = {
'password': password,
'this_server': request.build_absolute_uri('/'),
'ip': ip,
'port': '3389',
'address': r.address,
}
if os == 'windows':
@ -176,7 +179,6 @@ class RDPTransport(BaseRDPTransport):
else: # Mac
sp.update({
'as_file': r.as_file,
'ip': ip,
'as_cord_url': r.as_cord_url,
})
if domain != '':

View File

@ -9,7 +9,6 @@ try:
except ImportError: # Python 2.7 fallback
import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error
import os
import subprocess
from uds.log import logger # @UnresolvedImport
@ -18,7 +17,7 @@ from uds import tools # @UnresolvedImport
import six
try:
thePass = six.binary_type("""{m.password}""".encode('UTF-16LE'))
thePass = six.binary_type(sp['password'].encode('UTF-16LE')) # @UndefinedVariable
password = win32crypt.CryptProtectData(thePass, None, None, None, None, 0x01).encode('hex')
except Exception:
logger.info('Cannot encrypt for user, trying for machine')
@ -26,14 +25,16 @@ except Exception:
try:
key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, 'Software\Microsoft\Terminal Server Client\LocalDevices', 0, wreg.KEY_SET_VALUE) # @UndefinedVariable
wreg.SetValueEx(key, '{m.ip}', 0, wreg.REG_DWORD, 255) # @UndefinedVariable
wreg.SetValueEx(key, sp['ip'], 0, wreg.REG_DWORD, 255) # @UndefinedVariable
wreg.CloseKey(key) # @UndefinedVariable
except Exception as e:
logger.warn('Exception fixing redirection dialog: %s', e)
# The password must be encoded, to be included in a .rdp file, as 'UTF-16LE' before protecting (CtrpyProtectData) it in order to work with mstsc
theFile = '''{m.r.as_file}'''.format(password=password)
theFile = sp['as_file'].format(# @UndefinedVariable
password=password,
address=sp['ip']+':'+sp['port'] # @UndefinedVariable
)
filename = tools.saveTempFile(theFile)
executable = tools.findApp('mstsc.exe')