From 743773e256298e72c554b7c0b97be64d25300546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Mon, 18 Jan 2021 11:24:34 +0100 Subject: [PATCH 1/6] Working on new tunnel, translating client mods to new tunnel server --- client-py3/full/src/uds/tunnel.py | 37 ++++-- server/src/uds/transports/NX/nxpassword.py | 3 +- .../uds/transports/NX/nxtunneltransport.py | 40 ++----- .../uds/transports/NX/scripts/linux/tunnel.py | 4 +- .../NX/scripts/linux/tunnel.py.signature | 2 +- .../transports/NX/scripts/macosx/direct.py | 6 +- .../NX/scripts/macosx/direct.py.signature | 2 +- .../transports/NX/scripts/macosx/tunnel.py | 4 +- .../NX/scripts/macosx/tunnel.py.signature | 2 +- .../transports/NX/scripts/windows/direct.py | 15 ++- .../NX/scripts/windows/direct.py.signature | 2 +- .../transports/NX/scripts/windows/tunnel.py | 8 +- .../NX/scripts/windows/tunnel.py.signature | 2 +- server/src/uds/transports/RDP/rdptunnel.py | 23 +--- .../transports/RDP/scripts/linux/direct.py | 8 +- .../RDP/scripts/linux/direct.py.signature | 2 +- .../transports/RDP/scripts/linux/tunnel.py | 8 +- .../RDP/scripts/linux/tunnel.py.signature | 2 +- .../transports/RDP/scripts/macosx/direct.py | 16 +-- .../RDP/scripts/macosx/direct.py.signature | 2 +- .../transports/RDP/scripts/macosx/tunnel.py | 17 +-- .../RDP/scripts/macosx/tunnel.py.signature | 2 +- .../transports/RDP/scripts/windows/direct.py | 11 +- .../RDP/scripts/windows/direct.py.signature | 2 +- .../transports/RDP/scripts/windows/tunnel.py | 13 ++- .../RDP/scripts/windows/tunnel.py.signature | 2 +- .../transports/SPICE/scripts/linux/direct.py | 4 +- .../SPICE/scripts/linux/direct.py.signature | 2 +- .../transports/SPICE/scripts/linux/tunnel.py | 41 +++---- .../SPICE/scripts/linux/tunnel.py.signature | 2 +- .../transports/SPICE/scripts/macosx/direct.py | 4 +- .../SPICE/scripts/macosx/direct.py.signature | 2 +- .../transports/SPICE/scripts/macosx/tunnel.py | 41 +++---- .../SPICE/scripts/macosx/tunnel.py.signature | 2 +- .../SPICE/scripts/windows/direct.py | 6 +- .../SPICE/scripts/windows/direct.py.signature | 2 +- .../SPICE/scripts/windows/tunnel.py | 43 ++++--- .../SPICE/scripts/windows/tunnel.py.signature | 2 +- .../src/uds/transports/SPICE/spice_tunnel.py | 109 +++++++++++++----- .../transports/X2GO/scripts/linux/direct.py | 6 +- .../X2GO/scripts/linux/direct.py.signature | 2 +- .../transports/X2GO/scripts/linux/tunnel.py | 17 +-- .../X2GO/scripts/linux/tunnel.py.signature | 2 +- .../transports/X2GO/scripts/windows/direct.py | 6 +- .../X2GO/scripts/windows/direct.py.signature | 2 +- .../transports/X2GO/scripts/windows/tunnel.py | 20 ++-- .../X2GO/scripts/windows/tunnel.py.signature | 2 +- server/src/uds/transports/X2GO/x2go_tunnel.py | 88 +++++++++----- tunnel-server/src/forwarder/udstunnel.py | 44 ++++--- 49 files changed, 376 insertions(+), 308 deletions(-) diff --git a/client-py3/full/src/uds/tunnel.py b/client-py3/full/src/uds/tunnel.py index 086679bc..ff0cc36b 100644 --- a/client-py3/full/src/uds/tunnel.py +++ b/client-py3/full/src/uds/tunnel.py @@ -57,6 +57,7 @@ class ForwardServer(socketserver.ThreadingTCPServer): remote: typing.Tuple[str, int] ticket: str stop_flag: threading.Event + can_stop: bool timeout: int timer: typing.Optional[threading.Timer] check_certificate: bool @@ -79,20 +80,22 @@ class ForwardServer(socketserver.ThreadingTCPServer): ) self.remote = remote self.ticket = ticket - self.timeout = int(time.time()) + timeout if timeout else 0 + # Negative values for timeout, means "accept always connections" + # "but if no connection is stablished on timeout (positive)" + # "stop the listener" + self.timeout = int(time.time()) + timeout if timeout > 0 else 0 self.check_certificate = check_certificate self.stop_flag = threading.Event() # False initial self.current_connections = 0 self.status = TUNNEL_LISTENING + self.can_stop = False - if timeout: - self.timer = threading.Timer( - timeout, ForwardServer.__checkStarted, args=(self,) - ) - self.timer.start() - else: - self.timer = None + timeout = abs(timeout) or 60 + self.timer = threading.Timer( + abs(timeout), ForwardServer.__checkStarted, args=(self,) + ) + self.timer.start() def stop(self) -> None: if not self.stop_flag.is_set(): @@ -120,6 +123,9 @@ class ForwardServer(socketserver.ThreadingTCPServer): return context.wrap_socket(rsocket, server_hostname=self.remote[0]) def check(self) -> bool: + if self.status == TUNNEL_ERROR: + return False + try: with self.connect() as ssl_socket: ssl_socket.sendall(HANDSHAKE_V1 + b'TEST') @@ -135,11 +141,14 @@ class ForwardServer(socketserver.ThreadingTCPServer): @property def stoppable(self) -> bool: - return self.timeout != 0 and int(time.time()) > self.timeout + logger.debug('Is stoppable: %s', self.can_stop) + return self.can_stop or (self.timeout != 0 and int(time.time()) > self.timeout) @staticmethod def __checkStarted(fs: 'ForwardServer') -> None: + logger.debug('New connection limit reached') fs.timer = None + fs.can_stop = True if fs.current_connections <= 0: fs.stop() @@ -150,15 +159,17 @@ class Handler(socketserver.BaseRequestHandler): # server: ForwardServer def handle(self) -> None: - self.server.current_connections += 1 self.server.status = TUNNEL_OPENING # If server processing is over time if self.server.stoppable: - logger.info('Rejected timedout connection try') + self.server.status = TUNNEL_ERROR + logger.info('Rejected timedout connection') self.request.close() # End connection without processing it return + self.server.current_connections += 1 + # Open remote connection try: logger.debug('Ticket %s', self.server.ticket) @@ -169,7 +180,9 @@ class Handler(socketserver.BaseRequestHandler): data = ssl_socket.recv(2) if data != b'OK': data += ssl_socket.recv(128) - raise Exception(f'Error received: {data.decode(errors="ignore")}') # Notify error + raise Exception( + f'Error received: {data.decode(errors="ignore")}' + ) # Notify error # All is fine, now we can tunnel data self.process(remote=ssl_socket) diff --git a/server/src/uds/transports/NX/nxpassword.py b/server/src/uds/transports/NX/nxpassword.py index 9a524176..6699f3fa 100644 --- a/server/src/uds/transports/NX/nxpassword.py +++ b/server/src/uds/transports/NX/nxpassword.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- - # -# Copyright (c) 2012-2019 Virtual Cable S.L. +# Copyright (c) 2012-2021 Virtual Cable S.L.U. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, diff --git a/server/src/uds/transports/NX/nxtunneltransport.py b/server/src/uds/transports/NX/nxtunneltransport.py index 54134653..09d0cd64 100644 --- a/server/src/uds/transports/NX/nxtunneltransport.py +++ b/server/src/uds/transports/NX/nxtunneltransport.py @@ -84,34 +84,23 @@ class TSNXTransport(BaseNXTransport): label=_('Tunnel wait time'), defvalue='30', minValue=5, - maxValue=65536, + maxValue=3600 * 24, order=2, tooltip=_('Maximum time to wait before closing the tunnel listener'), required=True, tab=gui.TUNNEL_TAB, ) - ticketValidity = gui.NumericField( - length=3, - label=_('Tunnel ticket validity time (seconds)'), - defvalue='7200', - minValue=60, # One minute as min - maxValue=7*60*60*24, # one week as max - order=3, - tooltip=_('Maximum validity time for user ticket to allow reconnection'), - required=True, - tab=gui.TUNNEL_TAB, - ) - verifyCertificate = gui.CheckBoxField( label=_('Force SSL certificate verification'), order=23, - tooltip=_('If enabled, the certificate of tunnel server will be verified (recommended).'), + tooltip=_( + 'If enabled, the certificate of tunnel server will be verified (recommended).' + ), defvalue=gui.TRUE, - tab=gui.TUNNEL_TAB + tab=gui.TUNNEL_TAB, ) - useEmptyCreds = gui.CheckBoxField( label=_('Empty creds'), order=3, @@ -217,7 +206,6 @@ class TSNXTransport(BaseNXTransport): _cacheMem: str = '' _screenSize: str = '' _tunnelWait: int = 30 - _ticketValidity: int = 60 _verifyCertificate: bool = False def initialize(self, values: 'Module.ValuesType'): @@ -228,7 +216,6 @@ class TSNXTransport(BaseNXTransport): ) self._tunnelServer = values['tunnelServer'] self._tunnelWait = int(values['tunnelWait']) - self._ticketValidity = int(values['ticketValidity']) self._verifyCertificate = gui.strToBool(values['verifyCertificate']) self._tunnelCheckServer = '' self._useEmptyCreds = gui.strToBool(values['useEmptyCreds']) @@ -240,7 +227,6 @@ class TSNXTransport(BaseNXTransport): self._cacheDisk = values['cacheDisk'] self._cacheMem = values['cacheMem'] self._screenSize = values['screenSize'] - def marshal(self) -> bytes: """ @@ -262,7 +248,6 @@ class TSNXTransport(BaseNXTransport): self._tunnelCheckServer, self._screenSize, str(self._tunnelWait), - str(self._ticketValidity), gui.boolToStr(self._verifyCertificate), ], ) @@ -288,10 +273,9 @@ class TSNXTransport(BaseNXTransport): values[11] if values[0] == 'v2' else CommonPrefs.SZ_FULLSCREEN ) if values[0] == 'v3': - self._tunnelWait, self._ticketValidity, self._verifyCertificate = ( + self._tunnelWait, self._verifyCertificate = ( int(values[12]), - int(values[13]), - gui.strToBool(values[14]) + gui.strToBool(values[13]), ) def valuesDict(self) -> gui.ValuesDictType: @@ -306,7 +290,6 @@ class TSNXTransport(BaseNXTransport): 'cacheMem': self._cacheMem, 'tunnelServer': self._tunnelServer, 'tunnelWait': str(self._tunnelWait), - 'ticketValidity': str(self._ticketValidity), 'verifyCertificate': gui.boolToStr(self._verifyCertificate), } @@ -334,8 +317,8 @@ class TSNXTransport(BaseNXTransport): ticket = TicketStore.create_for_tunnel( userService=userService, - port=3389, - validity=self.ticketValidity.num() + port=int(self._listenPort), + validity=self._tunnelWait + 60, # Ticket overtime ) tunHost, tunPort = self.tunnelServer.value.split(':') @@ -367,10 +350,9 @@ class TSNXTransport(BaseNXTransport): 'ip': ip, 'tunHost': tunHost, 'tunPort': tunPort, - 'tunWait': self.tunnelWait.num(), - 'tunChk': self.verifyCertificate.isTrue(), + 'tunWait': self._tunnelWait, + 'tunChk': self._verifyCertificate, 'ticket': ticket, - 'port': self._listenPort, 'as_file_for_format': r.as_file_for_format, } diff --git a/server/src/uds/transports/NX/scripts/linux/tunnel.py b/server/src/uds/transports/NX/scripts/linux/tunnel.py index 061bf3f8..787f3314 100644 --- a/server/src/uds/transports/NX/scripts/linux/tunnel.py +++ b/server/src/uds/transports/NX/scripts/linux/tunnel.py @@ -18,13 +18,13 @@ except Exception: ''') # Open tunnel -fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) +fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) # type: ignore # Check that tunnel works.. if fs.check() is False: raise Exception('

Could not connect to tunnel server.

Please, check your network settings.

') -theFile = sp['as_file_for_format'].format( +theFile = sp['as_file_for_format'].format( # type: ignore address='127.0.0.1', port=fs.server_address[1] ) diff --git a/server/src/uds/transports/NX/scripts/linux/tunnel.py.signature b/server/src/uds/transports/NX/scripts/linux/tunnel.py.signature index 124035d6..8750295f 100644 --- a/server/src/uds/transports/NX/scripts/linux/tunnel.py.signature +++ b/server/src/uds/transports/NX/scripts/linux/tunnel.py.signature @@ -1 +1 @@ -Jb61ZM6xlsxMLnk4a2X2INN3IyGp+ztSgjXV+AsbH2hKDtKANM9nqHXgI/4LfxAogM3Y17k2tHOnbf049mWNaDRNCqOY9tG/xL3am2HkOTb3L9YOpK60gk/0hF9y1qLN9Y/CM+TP6B3DvVW+fsSnVfmDoK/NyqR5nb+6iRs37nmr+ILcum8IYgT4BeoKUqcMjHBQFF1MGfD5arKJW1t9pFQZw9+BZUzyw1c++2mnajIe294gjUEqgRxKPX6ejYX9J/AfAvM8K+NruT23VcxbBkp6diRUHFzM0buqHxUVzCqyfnU+umS7FKLOLw8M1B0goYfK8B0p8lu8ICRA24yOPpnnbBBWBUjZm3OZUGt7fqanaPbsVvehibxOsPB2z/vktp6mVBx8tkjU8Uyli1RxMSdT8xjsCT3mkK521AasqfE5Vn/Plwe9ciBo5AfqVxkl9OFVgUCCDTug9oNx50u+eSj/XUCxlTu39OBWUV6HAUhWDIgRWoYpLCC5Xtb+ILkgYPtTU8CiQSS2EFk8uUqxCSCbJKwfQRHhcYItSZk6fP0TH1nfirR8DB/AW5ltbO8QPe4PIllAyQl827fy6vQTytSw1wWBkEf7OCBEfv1w3AwFOC35fKQoRk+ygbD5fLhFbQsDpaMVtabNL/zjlw51CtrQfQ1ru69bvKeHLbp265M= \ No newline at end of file +EFxcQ0pD5IdbGBhlBdULIIPckwR0BlC2XQpWmxUngQlK/qe2s9CleQBjTcGyp6SSzy7uc6osweHA1b9N4o4opodLI0mD5X3H5+cP/92HsKcBT1QPRh1S8i+hGyGa5WO/fxdpeIM0rco9OcFDx9iloRbxCN0op3GJe3X0DwtS89r0MwaMs3rz7A913geshVGmJ/5oZM+EXf/kD6oGTRVkRagqeNkpB+Aup0LxhVET5EO6tY5TBDd2TvgCSBOqOkcA5vtavcxxb5As20lgl5/UsYDpCXuz7gGyq4EKn0nDSYHYiFeqsyJgaXWqdWW9rVQpGl8qjbm/Ndc2bC3s/3Q8bDgEjev0EQjKQ6oMUtdOJNJ89fP9TEd8Y0UKocBZRsGMxvQdcFN4Q5jMzplPcP9F3VuaCvA9W+uLZ/b1EvFPFdLrDBLhUsgUiWNoEQCqpG7FG+qz3dy0oVkmAZs9ewI6/oOxE+KaTs7uJv1mIbWpJEWhvLwzMg6j6jPSsV4bu9kbtjr3dBFwTNI5EsaW9vP9NeEg2hqD6vBOrlw4PB9SWIPBdFX0tPsT4tAgJxaUx13OepO7DWTItzA6EjT/be3BIUSJPoJuCJA7nxGj/ZOFqN4grmAlMKa8JXq8L/6++Jtqf+iSNgZjD+5cxC5j9M4yRlsBTFQaQhf+OnawjxAd1a4= \ No newline at end of file diff --git a/server/src/uds/transports/NX/scripts/macosx/direct.py b/server/src/uds/transports/NX/scripts/macosx/direct.py index aa512143..2a22b0fd 100644 --- a/server/src/uds/transports/NX/scripts/macosx/direct.py +++ b/server/src/uds/transports/NX/scripts/macosx/direct.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import subprocess import os -from uds import tools # @UnresolvedImport +from uds import tools # type: ignore cmd = '/Applications/OpenNX/OpenNX.app/Contents/MacOS/OpenNXapp' @@ -16,6 +16,6 @@ if os.path.isfile(cmd) is False: ''') -filename = tools.saveTempFile(sp['as_file']) # @UndefinedVariable -tools.addTaskToWait(subprocess.Popen([cmd, '--session={{}}'.format(filename), '--autologin', '--killerrors'])) +filename = tools.saveTempFile(sp['as_file']) # type: ignore +tools.addTaskToWait(subprocess.Popen([cmd, '--session={{}}'.format(filename), '--autologin', '--killerrors'])) # type: ignore tools.addFileToUnlink(filename) diff --git a/server/src/uds/transports/NX/scripts/macosx/direct.py.signature b/server/src/uds/transports/NX/scripts/macosx/direct.py.signature index c4cd32c7..1dfae0f1 100644 --- a/server/src/uds/transports/NX/scripts/macosx/direct.py.signature +++ b/server/src/uds/transports/NX/scripts/macosx/direct.py.signature @@ -1 +1 @@ -A4XL73+4BMMTm+pLNL5Ae4xqoZVasAxPc10CveDJFoSLNyierVIQRlNfbEP4ZuUSnpR/q01Y1KoRuYao5wQaNdW/4LKlnN4OFM01K04782Ug05JiSO1BZ8KBM5w8XmWyVqbmGveQiGVGWwyXwg0YqBmlSbMeFLDYZsO5ILq5F+FsY223C26P9XUiwzTSh58qb1OX6L6Yj5fhFVP3yLldy236SxBZAA7HmvoMvIGk8bKw4r+HRWtgfpUU5rxmFszNUikfcSSR45ci7qZYU/S6WuQ0RZD/5XV+jwTIQdZpn8qcFtXf5GSqSjdVV1vqUaRg04/cRpaFVZ8s+31Os00sZ7AWmBLFZAmRD8BRqks4Nz7RbjM2teH1+S67pvOPDzzYIiLpWeq0qQRKmJ6/DLprqBPfZ4uthqus2f6i6w2t+/CzI25K4Vrjaz0z3wp9k9O5bP7GFpFmfmwt0WW6jLJO43b4XVJ6N+yj02rvAGS2t1i/1S4IfK58/B6XMSchqUgPx1UiW/WHT7dujqiDDTMhLAncW7mwHs2ABwBlPfRxWkyHY8KZUpD9PWDypUf5JvOsNJgyNP/mXIDvCd2htscyfVkpZj5mAdeg9m3sMWNJivCHX0qa5KVcxyI2bn+MfBU9/khRTnOyhgikB8pHVnWqPIiSHL6BLdHiBFlJ7e8OYHw= \ No newline at end of file +hgPD0KnclF5OpaW4tIs+6pWX5tLeactCv1MGI1bk942nHoS4c/Nm87qd5dkHek51UMm1s8o2eB7xdrkJ6CVi/eOf2jnEs63luF+etmdwccHQU9BcQZjev1aId4q0q7HiQCXjXaS2vorIevH9uvf1NWl6AyPABynYhC7zvWb9nz/GTNBXO7TAqfVarGJLRXwY2KHpBXqUKEPB0H46+h3S9AWD2pHxfZnVBKdjoGgrD5/pt905aI2lrl1yCE14LFENkpssH/dBxYnaEMMYiWTuAe3lAP8MQEFlWmHBT63G7xMhDR3wc2sqC2eh8RQieEj1EoqCPLJFwMoxA1SZfS+JLhppskdJi06o+pqiJ4bzO0Is47plGn+KBodBAT+5/dOgOK/lKv+7Q8j3MS59TQUFty4TkybS6Ujk40SjlOlCwofVb6awKMSUSny853K20yKClt0gGhUjykstex3/eaXmU7hWLBBbDsFmY5W7Xhvxi1vPmrJ3uJ2M+R9WIeCM4xygLQPcMkZbY2k1bonv3NhK+AlapmY36y3IBbziL1Xv4agjRAykls3y+qrxMjE4Lx4ZUAI0OdX7COqdz7Ix7baYpMHrLgROjtkp/EJqVIfhvRSvJqMWLsZxbqCjoswNSI4zlyWFR980y4ITHhBsbP95X0yJnoRsgcN+wARNolxVL7o= \ No newline at end of file diff --git a/server/src/uds/transports/NX/scripts/macosx/tunnel.py b/server/src/uds/transports/NX/scripts/macosx/tunnel.py index b9567d66..72b32b18 100644 --- a/server/src/uds/transports/NX/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/NX/scripts/macosx/tunnel.py @@ -17,13 +17,13 @@ if os.path.isfile(cmd) is False: ''') # Open tunnel -fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) +fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) # type: ignore # Check that tunnel works.. if fs.check() is False: raise Exception('

Could not connect to tunnel server.

Please, check your network settings.

') -theFile = sp['as_file_for_format'].format( +theFile = sp['as_file_for_format'].format( # type: ignore address='127.0.0.1', port=fs.server_address[1] ) diff --git a/server/src/uds/transports/NX/scripts/macosx/tunnel.py.signature b/server/src/uds/transports/NX/scripts/macosx/tunnel.py.signature index ad30181d..e6a5df95 100644 --- a/server/src/uds/transports/NX/scripts/macosx/tunnel.py.signature +++ b/server/src/uds/transports/NX/scripts/macosx/tunnel.py.signature @@ -1 +1 @@ -sNIIRiS5PiCdCSHQ0Uv5iS4gdYBcFEfI8KPfvD1V8ZTry/Hw8NqB0qzHW0D3YgKGPZMBBnHM+mYiZNXwPuSObRn12Iw/dSh1kmSgh/1S/UvummsdD1vq8T8WdupvI8z1AyQemNPzjA0vUPhDhGakMy5/dAuy7hlND+K9swSTBI3kz5Dcx+PfsnNLxcCtCtmBT/3RDEESJlEVQAbH0sjt9sAQpHap8lDDV2vO/8kahKM4Gpre+uloFbjiYR53qEiQkECJipq3WWQbMq/5IIyBqcruXrHen0jybpuHoWjI++deS6d1NI6A+u9+oUp0AacQOnRzMdKUiykyA14Zjb+Hws0s/fVjPpWDqQMD52Ii1O6goCtsRszJVIdU7UGCTHYctBd+iQ3Qxk5cLXs/vBZ22WIwF6/YN62Gt9aIxonTojUevL2cvCQ6YrMR+X6fAIuvD1Jso86X4Fr2jGPPbzSnfLSn4dLtf8T6XPOn4mPaivosn9eUtMptJiUl3++vYGcdnOhF8Amk7hGUI58ck+gg+vo/MfUFCHTW3XxJtsD4Hr8uelgQNPvFs6whZuUSGVCjyvo107ikqafkiCu4QgWqMfmWzs8DVYAZ3KgPKaqp62R5gIIDdjwH0XZ4DET2+h8gFs+K+T1xcbbHvo8q8i2PRCSbdX9JsupOLuqE78NXAfA= \ No newline at end of file +lsChjBOL2LNJeEjnFSXjK3y9F8uPfz/j6ZlHg511XyQxakyrxPKhEnrAJ9DT7X7Py99D1SQqrMmn+A9B/lH658LmXyCLaQMKFVNLZxc1WH/0Ytl4int6ZJA3uTrt/bHYMNh91OxMsS6WPWjN8g2aCkGhgZIKHehP4oKlQmxOnI4EXSoWtHwl/aN2JaWV6pltiVDKMiyVxMHCnRm0L1KSVaOsC5OxW76DvsUWcYELXiue+bMlBx96lQN0/g4xd9UJKJFqRmA+tPnUhKYdm/gt1804xsdGQ2v2IdPiJjhBvN4riFUffkls0T67HFOEedNdoV7ox/lz8RmamlAGbs36Qz84U/hYdeEwpOZfzHvVKuq8M1EZQciboqdlaRDPDbF+o7mZHQsOCSzRTp6qBqb46pzcELuXBH4/jod/tAX9iyvz7BBxrQsTmhivHIwu3VOdjClN3bw2GrNSyhKxSYsb7wq/YiABfHWHJkHzMZnwxGOpYuYSHNNew2liH3zE3gZPX6rGnyFn7rv80rIGvbLmQV9hJmAluyzU6hQivHYqZnpnfQN1cKT5SKbDiZVCnAC9c8uPGD7VsHJZpaGR3Hi4bB/J2qyVG+zbfVVsLyRh/wDfGfucCBxt9ecY/xcZ6aebzabrEnyluhEmrehu6Ovp1lsWJQPb3mUzSHC0muN4M3s= \ No newline at end of file diff --git a/server/src/uds/transports/NX/scripts/windows/direct.py b/server/src/uds/transports/NX/scripts/windows/direct.py index 8eb6bf16..9b52dbaf 100644 --- a/server/src/uds/transports/NX/scripts/windows/direct.py +++ b/server/src/uds/transports/NX/scripts/windows/direct.py @@ -3,21 +3,24 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module -import _winreg +try: + import winreg as wreg +except ImportError: # Python 2.7 fallback + import _winreg as wreg # type: ignore import subprocess -from uds import tools # @UnresolvedImport - +from uds import tools # type: ignore try: - k = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Classes\\NXClient.session\\shell\\open\\command') # @UndefinedVariable - cmd = _winreg.QueryValue(k, '') # @UndefinedVariable + k = wreg.OpenKey(wreg.HKEY_CURRENT_USER, 'Software\\Classes\\NXClient.session\\shell\\open\\command') # @UndefinedVariable + cmd = wreg.QueryValue(k, '') # type: ignore + wreg.CloseKey(k) except Exception: raise Exception('''

You need to have installed NX Client version 3.5 in order to connect to this UDS service.

Please, install appropriate package for your system.

''') -filename = tools.saveTempFile(sp['as_file']) # @UndefinedVariable +filename = tools.saveTempFile(sp['as_file']) # type: ignore cmd = cmd.replace('%1', filename) tools.addTaskToWait(subprocess.Popen(cmd)) tools.addFileToUnlink(filename) diff --git a/server/src/uds/transports/NX/scripts/windows/direct.py.signature b/server/src/uds/transports/NX/scripts/windows/direct.py.signature index e96085be..a6cc67e9 100644 --- a/server/src/uds/transports/NX/scripts/windows/direct.py.signature +++ b/server/src/uds/transports/NX/scripts/windows/direct.py.signature @@ -1 +1 @@ -jyAVq4zJ1QR0otsMsh2vIarVH2Jy2UPGHi3JfLZPlwR1NFlM67f6uDgZO4wJNeQzOkPOGgpoklkB5ROxHjdUQUdm23XANXDpIZA1ywhrjLQ6lh4HSkbZ0i3QZizDAH5x5XxwHSOIrFeiT75qxXY67lFEXE4DhfxBMJMLm3xQyyjBxTyB1K/3UG3Ryhf0ApFqpaERoLEPJGjLeVj6bIeRre7TlxJMgO+VosjKkbUKRDTZD85X/iwvyRzGHy3OpS8zTOWt/Wstcph9+DrlPkbx8Z6yMpuwNW/mMEWblMcYWdyApBpnLEt8nLKlSQb3rGu2j7QaxzWwtPwuxWcd1IQzxCt0R/pbMlyl75QfrumKKoZ+MnPL4kK5kI4RHoBqzNKpirXHm36URfW5+9oKTuIgbwK6YvOPXtLAsYTtaWEmO21Tb6g+4XCzC1eoOlXWaA6NQe3rr0JXQpwAWjzg+EkaW0G45amef7ta4wGQC8zCZ1cSsA8uFGe6Q11fS94Q+Rv6rl5KubCf6KxvmsYDqkQkdzdvN8tDVkVX9mPNMaquLWaDWmKVp3Hp6WxdUELtAt50KfmGbaD7eMyLgHtBrhCUr1aRG3DxxysDOPhZYiO7Z73BR7OAeVM/bH3rpZLRsZOwi6s6zifqmmV5K2I5aozwybAQgVoR7+ZjZn5irPPULBc= \ No newline at end of file +isXacHwak7jQEx9QFKLUaVUTG75t5ogtWFiV7m7eMDttzBTkkS1/0hVLX1avLdaMOBCY60JTfTrPcHcd8XESfSzR3w92i1BzfccHmpV3g67lbeESZqpjsJTWC3F9kCpZHsj6DHXQICQjPPeW++tchJj8bAoETc6MyH5IHSJ/KOmbgLOBM+2x9crnX1ZWHrwF2xQyMaLn5rgntklvSX2KmOS6z0WC0C5DLFpVzZvSsDwMyfhhxd4fGNWCxUW4v5f5S1GUCM1AfzXWZEPYAWbRFgOzG2MKB2dhHasxVt25VtjeKgrD+Q5A28ihQBUkh5vZRmOtAWjtneF6K6bOM59ZL0vzjGIL1/y/6oysjyeOAG4YvagekMRAZT0folf7d4prUb1tN+8jvabZszGCxjvb0kYjfiT6zN53lxDSExLuvjBEwHkWM3CPCTkPLJ7UWiRT6Fyd8c3vJw860WhnohPYg+4q2udjf/ZgdDiyVPEyOB5AKpDnHB3HfsQr7upw+WqWUH56ylF2myWyP0uSmOrLJnUyFX1FFVx2R+/Rc0AjPmM+VE9UwPUkSSpFaRdKPP2nJxDYrReZwk/kfFmRvIqLAUz+rwSIH2JJqEB6NT//tMdxRu4lAKrpX29nqDSWCiMvew3D21OQYafzGGJ9GTn2n+Mwki3cbKpxLXxLxlCh0S8= \ No newline at end of file diff --git a/server/src/uds/transports/NX/scripts/windows/tunnel.py b/server/src/uds/transports/NX/scripts/windows/tunnel.py index 66587c94..158ae366 100644 --- a/server/src/uds/transports/NX/scripts/windows/tunnel.py +++ b/server/src/uds/transports/NX/scripts/windows/tunnel.py @@ -13,23 +13,23 @@ from uds.tunnel import forward # type: ignore from uds import tools # type: ignore - try: - k = wreg.OpenKey(wreg.HKEY_CURRENT_USER, 'Software\\Classes\\NXClient.session\\shell\\open\\command') # @UndefinedVariable + k = wreg.OpenKey(wreg.HKEY_CURRENT_USER, 'Software\\Classes\\NXClient.session\\shell\\open\\command') cmd = wreg.QueryValue(k, '') + wreg.CloseKey(k) except Exception: raise Exception('''

You need to have installed NX Client version 3.5 in order to connect to this UDS service.

Please, install appropriate package for your system.

''') # Open tunnel -fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) +fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) # type: ignore # Check that tunnel works.. if fs.check() is False: raise Exception('

Could not connect to tunnel server.

Please, check your network settings.

') -theFile = sp['as_file_for_format'].format( +theFile = sp['as_file_for_format'].format( # type: ignore address='127.0.0.1', port=fs.server_address[1] ) diff --git a/server/src/uds/transports/NX/scripts/windows/tunnel.py.signature b/server/src/uds/transports/NX/scripts/windows/tunnel.py.signature index 045d2b23..18045c5f 100644 --- a/server/src/uds/transports/NX/scripts/windows/tunnel.py.signature +++ b/server/src/uds/transports/NX/scripts/windows/tunnel.py.signature @@ -1 +1 @@ -jR6BkXPX1vmZqU6AMnLXJNwHhdw+v6pt4DdqpF0bWorB7tFbxAJ7U47A2NjDPSHMVpe2qtUIpL2eBAgpQCcfEbQNyzqpJmtS2w2y2lCHfT0sb/TMjsMJLfLpwJiH4dkRfF/bP7rAw55DHj4Q0Mc/lzwxGZuTOd+sjp89WxBximdD9y2/BQF9IRlsVGQOU2pjB1Ko1Wg719gXfqBM/ezg1gC2M8vAqxRZq6jyaPIRs+Hl1GALR2gi0MiwYckopJMWGQHmgGIUt8S9bAR8M5wkmNK3Fbc7qoa+tGuthfkoVYYqhSC2Wdd9tmhcVyGSwDv77OnN4QK9MAFSJxQV2GejaOn1Dp96prtmkNn1350d8y5kjTNFV0h4Y5sGW0XtDROrg/fdbuxHf7cZhn+hThotZjNfWp7PXbc5mlwwc+gYTGIwNd7qV20WzdBodvc6X79pJP4Oy2fZbMGYPdHYjiC8yPV+SliqrhUBCYLZI0z667rGupnyu4qh0ciRrz33AKHuQZZGJfux4WFOfhB9mMUyL621ospkORGKaWwr/v7dePotGUSkUbDHBrliN/qOlgHXls9C6NDGvXr1z2nlo2VCgjQMAxkqh8Lc/DDOOBSbcZ4S8RczxBwevYdKVA+ZZ1FP+PuhA/x50JtctbjiltaBFeK8buuv25PMsFVsNuNp05k= \ No newline at end of file +o+152nwWH5xKg7nrK4ffYSeGjzitZS5LxvkC9Z0aa86J2D9gEIsUqDAQjh2ljuO+g4ik2s72T7Yb5HiZizhHfRfjwe22yjIj+NtK1Xoeh/VW3773bq5VCXAjfMbVU6GuGnNMndQOn4qrS/l12YLDhxXFKUkpwNU1TjRGo33ns1DFPNTf0dT7W/WpQkf/75Jlt6bMnGxFWDWYhc1wLySmwlVPj7GOKQTD9pS9MaB7eqpq/GO9gADNGWcTbz3GGs8iO8N5dxBHTnyHxO7P29aQL9bOvtrY0rxAopfy+TTcuE03qNDI6pCBjhYxCqL+GqiRrzmLJq9ZtvhNxvQ5+kvDDrw3ErFZbXoBOF4f7SeP6Tr9A6aOkLG579czsqNGSpHqkUPgvb38xXfSPv983pDvzhi3lo2GzNhAu4ZYM+/Z/Q32ssYBfst4joHAC9mcHmP37ZTKRiMfRz3hafkJlSmm2RQf5/OPYCz5ha8AAcs2CvqYMlOiJhP9Zx8AwtB9oxVlFPS+ZUJ9h/0waRVFBKQm1m70Z7odjJqT0ThTTJQEjuedfnNuxW1V5GtCi62NcwskulWOL2fXjmf9eh0u5PPn1tdqLIUmZXa9eqGU+LjZqA52w7V3sHHWoMYvfEC4SG9HXfZxd6YZdfPx12z6WYh4PnJLNUqd7bgfl4YswALJyaA= \ No newline at end of file diff --git a/server/src/uds/transports/RDP/rdptunnel.py b/server/src/uds/transports/RDP/rdptunnel.py index c13e21cb..dfbc75cc 100644 --- a/server/src/uds/transports/RDP/rdptunnel.py +++ b/server/src/uds/transports/RDP/rdptunnel.py @@ -74,7 +74,6 @@ class TRDPTransport(BaseRDPTransport): ), tab=gui.TUNNEL_TAB, ) - # tunnelCheckServer = gui.TextField(label=_('Tunnel host check'), order=2, tooltip=_('If not empty, this server will be used to check if service is running before assigning it to user. (use HOST:PORT format)'), tab=gui.TUNNEL_TAB) tunnelWait = gui.NumericField( length=3, @@ -88,27 +87,16 @@ class TRDPTransport(BaseRDPTransport): tab=gui.TUNNEL_TAB, ) - ticketValidity = gui.NumericField( - length=3, - label=_('Tunnel ticket validity time (seconds)'), - defvalue='7200', - minValue=60, # One minute as min - maxValue=7*60*60*24, # one week as max - order=3, - tooltip=_('Maximum validity time for user ticket to allow reconnection'), - required=True, - tab=gui.TUNNEL_TAB, - ) - verifyCertificate = gui.CheckBoxField( label=_('Force SSL certificate verification'), order=23, - tooltip=_('If enabled, the certificate of tunnel server will be verified (recommended).'), + tooltip=_( + 'If enabled, the certificate of tunnel server will be verified (recommended).' + ), defvalue=gui.TRUE, - tab=gui.TUNNEL_TAB + tab=gui.TUNNEL_TAB, ) - useEmptyCreds = BaseRDPTransport.useEmptyCreds fixedName = BaseRDPTransport.fixedName fixedPassword = BaseRDPTransport.fixedPassword @@ -175,11 +163,10 @@ class TRDPTransport(BaseRDPTransport): ticket = TicketStore.create_for_tunnel( userService=userService, port=3389, - validity=self.ticketValidity.num() + validity=self.tunnelWait.num() + 60, # Ticket overtime ) tunHost, tunPort = self.tunnelServer.value.split(':') - r = RDPFile( width == '-1' or height == '-1', width, height, depth, target=os['OS'] diff --git a/server/src/uds/transports/RDP/scripts/linux/direct.py b/server/src/uds/transports/RDP/scripts/linux/direct.py index e1aa9a38..8645b516 100644 --- a/server/src/uds/transports/RDP/scripts/linux/direct.py +++ b/server/src/uds/transports/RDP/scripts/linux/direct.py @@ -2,24 +2,22 @@ # Saved as .py for easier editing from __future__ import unicode_literals -# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index import subprocess -import re -from uds import tools +from uds import tools # type: ignore # Inject local passed sp into globals for inner functions globals()['sp'] = sp # type: ignore # pylint: disable=undefined-variable def execUdsRdp(udsrdp): import subprocess # @Reimport - params = [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable + params = [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # type: ignore tools.addTaskToWait(subprocess.Popen(params)) def execNewXFreeRdp(xfreerdp): import subprocess # @Reimport - params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable + params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # type: ignore tools.addTaskToWait(subprocess.Popen(params)) # Try to locate a "valid" version of xfreerdp as first option (<1.1 does not allows drive redirections, so it will not be used if found) diff --git a/server/src/uds/transports/RDP/scripts/linux/direct.py.signature b/server/src/uds/transports/RDP/scripts/linux/direct.py.signature index a334ae1a..6921b2c9 100644 --- a/server/src/uds/transports/RDP/scripts/linux/direct.py.signature +++ b/server/src/uds/transports/RDP/scripts/linux/direct.py.signature @@ -1 +1 @@ -m7XY+kUSxXSqD276bNG7ChwBU06IOR75uTw9eXdSdBYqbvG4FhrUmL1OXRjfNRUh5kzUqkIggcJ5mj3b5Ws76QMWUjqcKS+SM2V5CGOzzPW+lFDeMLEnLCtsrmxZcCPacLce/utMlNf/AqLnraWAUCj8s+5CR68FeHE9fH3CRUryjHhvUPf51GDpMMXq+jnLotWn34xgZ2DI62Kp39qTdFYhmnZ3cGI3cHSks5Jo+uqeD1n0J+pF7vPM22aRknxW8XcLj+tXeUSw1QZVD0tXOI8RaUeD1jAH3bn0tBwP2spUfBwLFsxbWDULkuN89klfe1C/rardNJgIog7pUyyUD4HmeYQqd31Z5kfno3KD9NeAkEe8EaW99PAj3maLPrl8wZB6myYJfiq5k0LV0tzt5JNy20p61JOXFl4F04Ndb0m+IlcvYcknfecsF5RA6ID9U/0vX84y0OHtrEut1G5OBck95X2l0ksKHYcCqxhSKAAds227aeHI3FcWNsIpGpvtnQDrCrxM/lHO5mXk9+t4OVCG8dxawNrSoRmx1gUN/QvRiZvRFJ3WFZgo4OLc6ls62YBxm8FhWn+19NyVzXKI5U+Q5wJFAUkZ7+XnnHrvz75zvt/Ym5SvgMHSBMe7L+4njcEFq5UMfiTCEATorJXk03YDUrQI7uKiE0UTVwIJlGc= \ No newline at end of file +eY7ynpCTiB3Y0zGryBe7SAuc426LEi4+UbyAbMmZXi4I8uFA4KnO7lsQfdmfDjIzZqktTWaAQBGy0cRUEypa8fjbPc+TrkQmAJerLE5+DtH1RH2eHm9eH5uQHN7e4tn8vf3NrD5FCYdenOlVXtzCZhauATjy7VyjMha5RfPbuRDfHvNPcAwlE4Ty6Im8oKBa3kLmCczdI1eSKZgrXHrzDOyJYpIAlBE6RknVusGEcPnUbtoPxgBB3/YNIcy3AswToyElrmWeY0egpYm3skcTKtrrvKD5zc74ueTb5WZER0EzCfEZNHPwo6QnCbyo06U5u6dEkBg1kVFIXxEx/OoIXwpWWUWJn08cqVA/g7RNNdkXZ4iB9v4gRducZEpWGJbH8aq0tOSBOgTg7dxN1SGoayXQT0We3pCZL8Utl/gU5FqvCCGBeHE3dq/ELoAlFuq66AHV+stY08cUuURPObvgwrwA18HpmnppXgYY3RXmX8udfxwCCvOzya4iTuzC4mlQTj/QbYvKCtOgnP/upv7bEhu0+bGfTYSyLBKNFPItgIThc0ockn0BxSHuM0Ln2mK5COruhyYh3sNaQALFGST6pcBm2SvfP1HqWKzvB2V6a+xls5yqYtAR9RyHvZ1bc5QouwKNgqjzV9xSclf7QBwPjXTlOXvln6s4dj6LhLyt9kg= \ No newline at end of file diff --git a/server/src/uds/transports/RDP/scripts/linux/tunnel.py b/server/src/uds/transports/RDP/scripts/linux/tunnel.py index 1a395345..05bb72a8 100644 --- a/server/src/uds/transports/RDP/scripts/linux/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/linux/tunnel.py @@ -2,9 +2,7 @@ # Saved as .py for easier editing from __future__ import unicode_literals -# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index import subprocess -import re from uds.tunnel import forward # type: ignore from uds import tools # type: ignore @@ -14,13 +12,13 @@ globals()['sp'] = sp # type: ignore # pylint: disable=undefined-variable def execUdsRdp(udsrdp, port): import subprocess # @Reimport - params = [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # @UndefinedVariable + params = [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # type: ignore tools.addTaskToWait(subprocess.Popen(params)) def execNewXFreeRdp(xfreerdp, port): import subprocess # @Reimport - params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # @UndefinedVariable + params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)] # type: ignore tools.addTaskToWait(subprocess.Popen(params)) # Try to locate a "valid" version of xfreerdp as first option (<1.1 does not allows drive redirections, so it will not be used if found) @@ -41,7 +39,7 @@ if app is None or fnc is None: ''') else: # Open tunnel - fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) + fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], timeout=sp['tunWait'], check_certificate=sp['tunChk']) # type: ignore # Check that tunnel works.. if fs.check() is False: diff --git a/server/src/uds/transports/RDP/scripts/linux/tunnel.py.signature b/server/src/uds/transports/RDP/scripts/linux/tunnel.py.signature index 31ecf5ce..463de057 100644 --- a/server/src/uds/transports/RDP/scripts/linux/tunnel.py.signature +++ b/server/src/uds/transports/RDP/scripts/linux/tunnel.py.signature @@ -1 +1 @@ -F12wItI+7Bo+mnANcC0IX3hdcr7d/V+XbnX7sH6zKpw7q/gEJBZW3xHaKpYDWBYYsR5pkCiJ+zawt7lHcc7+GmPJYIpFeXZeGlJWjrNN5FqqI02C+sRnuImX9DNggHGNW0hn3mGdE6U/wB1T6clXtoMK6um8cpLVQtfcVUKn1/gki4dMg+0NSJhQHfBpeQ1yffO/VLaTBWB2qnnQUjYNkqGo0x+nxJ4G67jqJU/sh0vM0OyT3JQwgIH+AidCqL694amngAprWzlOiABL3NoF/yJjn9bBfLHhHtsVp4v1YsYjTWXMegVRK8HWGvAaiGzRbOAdfjZl8GejaROSpLQTo5djBwuHN7ULtnNpk0ZCYJP00AKvQU6yW3omm5c2vZwVc1yUj5fzxnY4QY6VcpoSK15p8wR0FEWaY6kdE4bf2PWwaBGcNVGIe7itmwKv0n7AhZsJG68zmZOR45PNx1ljgFCco/Sg+rGnAxk09c0DtZNIs3BR7lhcUUHo16EFTHeUI8RwxyMKRBW75bTqrNMDUtwk7yxA58ec/mAkZmdlJ5MLYOAc1iL3U+qd8ZKxMOiwo9ZWZNsgLALXfKcg8/DGponnsrPXkmEY4CigW25t9fdooJ8WwrDTssYQJdmmOgXAkj5YyjcEryF73gXaGYL2j9tu6VKEfs9cY5WtGvfJUmA= \ No newline at end of file +qohDf0W4PxfiAn8RDcQrZcl3v/V6+B6Zj2Ba2FukDlm+XXEbrNE0dHONXJPd6zTZ+lWRvYrTHKWWyJVgRoN3gxhEghY+iw+4B4yX6uwxynb/DtHNVg8wG1tFzFfGnHCua9E7+iY+5Y6oDJo76tOmLGYZNGmOA0vwn5IDNqIKTqnAPzJnNbpHrePV5LO/xF59aZ2RthxhcBquSpkZA8Hm9z7Hw4oagOysqSknXTxdyeLBxQLc+KpGXhdo8jbD2In+21r/9V3pqFUM5AyL85tl5eunhDDyKt5KvN8vznMFCITxpJWQ8BSWtqOqNiJvhfqSXm3CVlATeLEDOeuVinF/P4AYzw9qybagKyxL0GQTSATXEmarevAKsZ5nvY5wPUx1BL6OloUWXHjlAvSDCBIRyde3ravDWtT+cajQGyinD8Mhb4emOutr/syirKZXDK8orP3L0gEMCqERKHrv0IpbIldyiyZ2Pt85lvtAQ0nYkPBUnA/kodBrESgJ0DVFqZLEx1YhzEEHEVGZuklt/hUpOzOhtTGhT2MHG2la8ANYJo8pQ+QZTaMtZHGH4uI3r6AxrI7DIBa1K5JZn66jC5pFik5Y7KcJR9d+D8QZU8QVFK4pz5oO6RI7xzka48MxhV3CFvRQ+wDeukfOWS1xThpabxPQbsrc0O/KLFkRrzsHHco= \ No newline at end of file diff --git a/server/src/uds/transports/RDP/scripts/macosx/direct.py b/server/src/uds/transports/RDP/scripts/macosx/direct.py index d093ba82..036b4007 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/direct.py +++ b/server/src/uds/transports/RDP/scripts/macosx/direct.py @@ -7,7 +7,7 @@ import subprocess import shutil import os -from uds import tools # @UnresolvedImport +from uds import tools # type: ignore # Inject local passed sp into globals for functions globals()['sp'] = sp # type: ignore # pylint: disable=undefined-variable @@ -20,18 +20,18 @@ def fixResolution(): import re import subprocess results = str(subprocess.Popen(['system_profiler SPDisplaysDataType'],stdout=subprocess.PIPE, shell=True).communicate()[0]) - res = re.search(': \d* x \d*', results).group(0).split(' ') + res = re.search(r': \d* x \d*', results).group(0).split(' ') width, height = str(int(res[1])-4), str(int(int(res[3])-128)) # Width and Height - return list(map(lambda x: x.replace('#WIDTH#', width).replace('#HEIGHT#', height), sp['as_new_xfreerdp_params'])) + return list(map(lambda x: x.replace('#WIDTH#', width).replace('#HEIGHT#', height), sp['as_new_xfreerdp_params'])) # type: ignore # Check first xfreerdp, allow password redir if os.path.isfile(xfreerdp): executable = xfreerdp -elif os.path.isfile(msrdc) and sp['as_file']: +elif os.path.isfile(msrdc) and sp['as_file']: # type: ignore executable = msrdc if executable is None: - if sp['as_file']: + if sp['as_file']: # type: ignore raise Exception('''

Microsoft Remote Desktop or xfreerdp not found

In order to connect to UDS RDP Sessions, you need to have a

''') elif executable == msrdc: - theFile = sp['as_file'] + theFile = sp['as_file'] # type: ignore filename = tools.saveTempFile(theFile) # Rename as .rdp, so open recognizes it shutil.move(filename, filename + '.rdp') @@ -75,8 +75,8 @@ elif executable == xfreerdp: try: xfparms = fixResolution() except Exception as e: - xfparms = list(map(lambda x: x.replace('#WIDTH#', '1400').replace('#HEIGHT#', '800'), sp['as_new_xfreerdp_params'])) + xfparms = list(map(lambda x: x.replace('#WIDTH#', '1400').replace('#HEIGHT#', '800'), sp['as_new_xfreerdp_params'])) # type: ignore - params = [executable] + xfparms + ['/v:{}'.format(sp['address'])] # @UndefinedVariable + params = [executable] + xfparms + ['/v:{}'.format(sp['address'])] # type: ignore subprocess.Popen(params) diff --git a/server/src/uds/transports/RDP/scripts/macosx/direct.py.signature b/server/src/uds/transports/RDP/scripts/macosx/direct.py.signature index ac47080a..d5e1fb52 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/direct.py.signature +++ b/server/src/uds/transports/RDP/scripts/macosx/direct.py.signature @@ -1 +1 @@ -noBupbQ4cXphbjY5YyaiPhqdv7z47GKvj++IvZHyyyit+9wWgZGxaPx+bLmqvr6Rz+ZJrxXYcW4qk5+CN+AKDe2aoGzbusAziBdd0Oluik09Vl5EHq1+OPUp/VkdNHu3M6EB8SiwwHM0KGWz5PEvegp5V3xyaJutnr7JcEMrMxGL97iCbYtKT3G7BaZOY/gCO7BPTexJlyjZ66xb8+hmUTix12Cnwhxpn2xEuZ3N6raGtbmgOHAp6SHz4Y78GBnFhHrhu/EnkHZVgSIoQbyW9koB2tBYdQi3915sUvTLIdHuN3kjz9UKSH/tPJVL+CGrBE/+TXJe90xOTBbzRAgZcUtUjCNyDULhRCT87N1sRH5RFJNsvQv3cqYTgnVUBF5Oew8guTj0UdAAB6tGtUdZqFXz4NspA+f+PkzLmUzmd8y6hqwX4Ojbh0SL0N3Tb5SJw+uOcKTN/FNSEavWK62alPyA36VDf0IIJLV604DhxvOeUTWYz0H7TnrME4e5d9F82iYPCre71yNofzHihZ5SelKJUQ0AniZxQIY+7vYcZNRpcEkGnt0oTWHDvXeTqDwtAkvzwt3QvTsl7/i3yDQ2XYJInICLWaM81op/sVOSM+DSgEd0n+O3r1SE/dD72u0VhSMZYYKZw0ZApcFXMHBk7c9DcjVYMXoMFMKqsqnoe9A= \ No newline at end of file +Ro5JrmfPQnCaJAd5mc1x+wKPoB3ipy3ueRnbD00lUtKhTpLxNm2HGovfEk8CbL3VOzpDyvvavWGo+wiU1qpU1baF5/gGzGYuFQiFB4da+kwjSmd8Jr6p9p9KS3eTkRD5GiWV5zBCHNnlO9200+gw9tvMGllZ65chkEbCHaN1MGiP6Af3wi9hK9yi2QR8sqpxqJ06UgolK+HM2OFuZTf28BVNZACcL8rZmCpjVN27nv9WE7nYnICr5OXL9VV7uclZuLH9VjZkkxpJWH3o8E8ftO6MqbOBeLwlyZgQU+PlGHu4rXtSjH39h9tSLjbAkF4YrT2n6yO9BxrEwqasW+mwnMqm0uI4Cpj60nKrm9eTEIPMhsgZRGyCcA0l/ozzBKwtOfP2OLu1bPdUNdU7XlW6ctgjcfczukCU3/aEbVACkv+6nsg7EFoFkPW4RN+xbB5URaTlA7ddfbjKkCQjY5h/ZeEEm0Nj8e+uIYzOmA9/ftsQOWyhTkwRqK4o+bylQFWSQJhGWPB7hF4jY01yPo7sLY9H/YMci2ds1emys0K4tyyBDQOjcqRz6H0owvjPmWAPflJ6w+g39yklzPdegj4zHzbCtj0NFkWY0xGxhEclG/meTh1txl1SflU1k2E7LtLlV8x3Lgm1FF/QNFH/u0bBlXHg8AMik6Qi9fcf5NEveKY= \ No newline at end of file diff --git a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py index 5528515e..d62e37d2 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py @@ -18,9 +18,9 @@ def fixResolution(): import re import subprocess results = str(subprocess.Popen(['system_profiler SPDisplaysDataType'],stdout=subprocess.PIPE, shell=True).communicate()[0]) - res = re.search(': \d* x \d*', results).group(0).split(' ') + res = re.search(r': \d* x \d*', results).group(0).split(' ') width, height = str(int(res[1])-4), str(int(int(res[3])-128)) # Width and Height - return list(map(lambda x: x.replace('#WIDTH#', width).replace('#HEIGHT#', height), sp['as_new_xfreerdp_params'])) + return list(map(lambda x: x.replace('#WIDTH#', width).replace('#HEIGHT#', height), sp['as_new_xfreerdp_params'])) # type: ignore msrdc = '/Applications/Microsoft Remote Desktop.app/Contents/MacOS/Microsoft Remote Desktop' @@ -30,11 +30,11 @@ executable = None # Check first xfreerdp, allow password redir if os.path.isfile(xfreerdp): executable = xfreerdp -elif os.path.isfile(msrdc) and sp['as_file']: +elif os.path.isfile(msrdc) and sp['as_file']: # type: ignore executable = msrdc if executable is None: - if sp['as_rdp_url']: + if sp['as_rdp_url']: # type: ignore raise Exception('''

Microsoft Remote Desktop or xfreerdp not found

In order to connect to UDS RDP Sessions, you need to have a