1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-05 09:17:54 +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: if tools.verifySignature(script, signature) is False:
logger.error('Signature is invalid') 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() self.stopAnim()

View File

@ -54,7 +54,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
CLIENT_VERSION = UDS_VERSION CLIENT_VERSION = UDS_VERSION
REQUIRED_CLIENT_VERSION = '2.5.0' REQUIRED_CLIENT_VERSION = '3.0.0'
# Enclosed methods under /actor path # Enclosed methods under /actor path
@ -150,7 +150,7 @@ class Client(Handler):
return Client.result(result={ return Client.result(result={
'script': transportScript, 'script': transportScript,
'signature': signature, # It is already on base64 '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: except ServiceNotReadyError as e:
# Refresh ticket and make this retrayable # Refresh ticket and make this retrayable

View File

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

View File

@ -9,7 +9,6 @@ try:
except ImportError: # Python 2.7 fallback except ImportError: # Python 2.7 fallback
import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error
import os
import subprocess import subprocess
from uds.log import logger # @UnresolvedImport from uds.log import logger # @UnresolvedImport
@ -18,7 +17,7 @@ from uds import tools # @UnresolvedImport
import six import six
try: 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') password = win32crypt.CryptProtectData(thePass, None, None, None, None, 0x01).encode('hex')
except Exception: except Exception:
logger.info('Cannot encrypt for user, trying for machine') logger.info('Cannot encrypt for user, trying for machine')
@ -26,14 +25,16 @@ except Exception:
try: try:
key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, 'Software\Microsoft\Terminal Server Client\LocalDevices', 0, wreg.KEY_SET_VALUE) # @UndefinedVariable 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 wreg.CloseKey(key) # @UndefinedVariable
except Exception as e: except Exception as e:
logger.warn('Exception fixing redirection dialog: %s', 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 # 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) filename = tools.saveTempFile(theFile)
executable = tools.findApp('mstsc.exe') executable = tools.findApp('mstsc.exe')