diff --git a/server/src/uds/transports/RDP/scripts/linux/direct.py b/server/src/uds/transports/RDP/scripts/linux/direct.py index 2fad82da2..29a5acaf2 100644 --- a/server/src/uds/transports/RDP/scripts/linux/direct.py +++ b/server/src/uds/transports/RDP/scripts/linux/direct.py @@ -11,7 +11,7 @@ def execUdsRdp(udsrdp): import os.path params = [os.path.expandvars(i) for i in [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])]] # type: ignore - tools.add_task_to_wait(subprocess.Popen(params)) + tools.addTaskToWait(subprocess.Popen(params)) def execNewXFreeRdp(xfreerdp): @@ -19,12 +19,12 @@ def execNewXFreeRdp(xfreerdp): import os.path params = [os.path.expandvars(i) for i in [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])]] # type: ignore - tools.add_task_to_wait(subprocess.Popen(params)) + tools.addTaskToWait(subprocess.Popen(params)) # Try to locate a xfreerdp and udsrdp. udsrdp will be used if found. -xfreerdp = tools.find_application('xfreerdp') -udsrdp = tools.find_application('udsrdp') +xfreerdp = tools.findApp('xfreerdp') +udsrdp = tools.findApp('udsrdp') fnc, app = None, None if xfreerdp: 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 3752043ac..fc76c4c70 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 @@ -TVj9WtvB+5wTWvZstXfXR2gzyKRIi+t0js0tGkTBcJvwf+xS+c/k5F6ShRlP2d4WCmwm6VunPQJsQBNIfSCfpBOjbxKYWk3e/fa35G5lfL3nZmCwEYLDdRURwq6im3GPY2OxqhG8W9bOKFfDc1EEaHiFT44ivdaIqqYqmAzLuwRWQLq6aT0L29OVW1dOMheCV/jDwDr1ARHPea7hvWd8uVYY6iNEFUdtKEZP1+P+OHy4HFizfrEocnQllpcTRcvtABMa53KmGQ0DwfU+IwpLeKgJ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sFCX0wJ2IB4TtH7V9/9uJnI= \ 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 1a48cb88b..6315cfd17 100644 --- a/server/src/uds/transports/RDP/scripts/linux/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/linux/tunnel.py @@ -13,7 +13,7 @@ def execUdsRdp(udsrdp, port): import os.path params = [os.path.expandvars(i) for i in [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)]] # type: ignore - tools.add_task_to_wait(subprocess.Popen(params)) + tools.addTaskToWait(subprocess.Popen(params)) def execNewXFreeRdp(xfreerdp, port): @@ -21,12 +21,12 @@ def execNewXFreeRdp(xfreerdp, port): import os.path params = [os.path.expandvars(i) for i in [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)]] # type: ignore - tools.add_task_to_wait(subprocess.Popen(params)) + tools.addTaskToWait(subprocess.Popen(params)) # Try to locate a xfreerdp and udsrdp. udsrdp will be used if found. -xfreerdp = tools.find_application('xfreerdp') -udsrdp = tools.find_application('udsrdp') +xfreerdp = tools.findApp('xfreerdp') +udsrdp = tools.findApp('udsrdp') fnc, app = None, None if xfreerdp: 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 04edcb266..fcf5cb3e3 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 @@ -Iqpghqb7YSP/lr51OUil2uU//SPt6vgJqmUPSHKGFyNTlT0b03sZG8UrihEdsdqYsmqDXnyP3m0zscz6k/hHpICIAX0zt9U3sKGnXknT42uaNFXniEuKOr72s+izZ6tRvLtxoT8KPl+bJLiYM5aQWna9YIMGHFLhGUf2wP5BNmPWO4aF7uvLVr0vQhGD7fEO+8CT+miZJHcwUAsZnoN+2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pjAaYC9mpYAwjJBGEtL9sFNTZx+w2D0PS0vNRUIjoR/PoZ1FGOiy3CiL7qKij/1I6QSIHOxp3wo4yROzR94I= \ 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 f29ddef1f..2e80328b6 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/direct.py +++ b/server/src/uds/transports/RDP/scripts/macosx/direct.py @@ -1,4 +1,4 @@ -import subprocess # nosec No user input here +import subprocess import shutil import os import os.path @@ -16,16 +16,16 @@ msrdc_localized = ( ) # msrdc_app = '/Contents/MacOS/Microsoft Remote Desktop' -xfreerdp = tools.find_application('xfreerdp') +xfreerdp = tools.findApp('xfreerdp') executable = None def fixResolution(): import re - import subprocess # nosec No user input here + import subprocess results = str( - subprocess.Popen( # nosec No user input here + subprocess.Popen( ['system_profiler SPDisplaysDataType'], stdout=subprocess.PIPE, shell=True ).communicate()[0] ) @@ -85,14 +85,14 @@ if executable is None: ) if executable in (msrdc, msrdc_localized): theFile = sp['as_file'] # type: ignore - filename = tools.save_temp_file(theFile) + filename = tools.saveTempFile(theFile) # Rename as .rdp, so open recognizes it shutil.move(filename, filename + '.rdp') - # tools.add_task_to_wait(subprocess.Popen(['open', filename + '.rdp'])) + # tools.addTaskToWait(subprocess.Popen(['open', filename + '.rdp'])) # Force MSRDP to be used with -a (thanks to Dani Torregrosa @danitorregrosa (https://github.com/danitorregrosa) ) - tools.add_task_to_wait( - subprocess.Popen( # nosec No user input here + tools.addTaskToWait( + subprocess.Popen( [ 'open', '-a', @@ -101,7 +101,7 @@ if executable in (msrdc, msrdc_localized): ] ) ) - tools.register_for_delayed_deletion(filename + '.rdp') + tools.addFileToUnlink(filename + '.rdp') elif executable == xfreerdp: # Fix resolution... try: @@ -110,4 +110,4 @@ elif executable == xfreerdp: xfparms = list(map(lambda x: x.replace('#WIDTH#', '1400').replace('#HEIGHT#', '800'), sp['as_new_xfreerdp_params'])) # type: ignore params = [os.path.expandvars(i) for i in [executable] + xfparms + ['/v:{}'.format(sp['address'])]] # type: ignore - subprocess.Popen(params) # nosec No user input here + 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 1049179ab..a60d123d6 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 @@ -IkF0aY4g2AOPSjWFZrnIgssZSnOxTwkqkbPjyUh7wHDO5Y3xzGLo8HFSm+bumu13SPazxVjN3ST2EMj3DlPb1XBU1ywFY5PLF1ArJkrSOSUGJpqAiRsfg9YNjNLDu5RGamkaj3yEyLnkO9ma5r+IeFcfKxYJwI02HmRJVUlopO30etz6gqB1NQkmFGCLnrVRSJHIsJ1LCUiLnQqNq9KwtEIxaCewzmt+SABnZTjU6h8hUmh6oKnRKKrC9iOgeVsHoo3ErBAmfdUJOiU+AVlud+vsub6z+L7PZJC0NIXLvCnF4b+xFrYQMWzyEi1PKPHmAtuUuQz9zSe8+NYa3nia1iNK4izIVxjh7VV8nRQnbgg7q4+OPVW3R+k0PDxqwJB+ANb/WFzux7aS+6IeHGxfNA28oCMO0LJ4ZphkgdyQkNJWE45W8LOGrGLFAf5cC1/psUOmlWUQ8JbAhN3P99/bqrAe00VrceusE8e+gmVEGh8NS0fn9+2aIXZBr+oFq0uSF+XNbt7URbu7+uN+rjHxttVWssb2xuZFeAUpiGCiZx0m4HBOLxE6q/waryjj3/kmgkf+iWDrZrQBn9m3F+2V53TG7uRHTHOaEJKiApw5Aj+LvYHS+neh+M0EL5W2tg28Ckwh4fQEk8rLT/CMrYBY90Cl6Vss1Egj6p1ksS/dfyE= \ No newline at end of file +SijMzRukH+xARWhBXzy3Xu0fCA35ToaOZbn7LhYGxpYAGwMYGz2o6AfproZSSg/PtTwJjurqwGvTGkcS80ZvMMx/xNiHUJw1dUygcKKWBbsra/uEdMTTnkXiZZo61VJAl/Xk74hTbU8f6QEmoZwxXVr+DcrX7kqXhr/YuRxRS16rmWu0mYwu45p45X6tOB5z7ySDXJvjWg8uzdXZwKuUSh0TZi5PKCzzP/u8yVou8t6TkNk4Szh6KA7RcnEzrPzIYnNesfBH0GiFUTo8FYavN4rsTMU3FcYN9dfEy3eqwGsfizJ9c8fXlsYYAS5lO2TyNHq8HwL3uEl1uzihu0Z64pLX5xDC+oSRxMPuFR88XyfzM58bUPbGa/DVnSwKRHJO16tDh4pZ133wO7alSi80VYrgR2OB61LA7NcQlO0iQGjXFSqRoYVXL9mU3yHWngm8jb8UIrXYyyZfKTS46dbqko0BQ2h2n/JPIFS1D0x//rePc5R9Mp/oDrZk1+9JhZ+fPULX/X0jLxxVG9xHhSQ2IscLqswOBbgvqcjsz44+hmdzWwXMABizxMiMk1DOh0caMAKQPvncqCcMwZNsUygLh4GQxxcfLSTFSuEtGgw26sQctmIIhXtcMl0gy/nFY8uvlhwwzVbdbFFumRmB0xyuhYvDOfdFaQrz3i6utuFFaAk= \ 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 dff1fcbd1..47697b9ad 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py @@ -1,6 +1,7 @@ -import subprocess # nosec No user input here -import os +# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index +import subprocess import shutil +import os import os.path from uds.tunnel import forward # type: ignore @@ -13,10 +14,10 @@ globals()['sp'] = sp # type: ignore # pylint: disable=undefined-variable def fixResolution(): import re - import subprocess # nosec No user input here + import subprocess results = str( - subprocess.Popen( # nosec No user input here + subprocess.Popen( ['system_profiler SPDisplaysDataType'], stdout=subprocess.PIPE, shell=True ).communicate()[0] ) @@ -38,7 +39,7 @@ msrdc_localized = ( '/Applications/Microsoft Remote Desktop.localized/Microsoft Remote Desktop.app' ) -xfreerdp = tools.find_application('xfreerdp') +xfreerdp = tools.findApp('xfreerdp') executable = None # Check first xfreerdp, allow password redir @@ -99,14 +100,14 @@ if fs.check() is False: if executable in (msrdc, msrdc_localized): theFile = theFile = sp['as_file'].format(address=address) # type: ignore - filename = tools.save_temp_file(theFile) + filename = tools.saveTempFile(theFile) # Rename as .rdp, so open recognizes it shutil.move(filename, filename + '.rdp') - # tools.add_task_to_wait(subprocess.Popen(['open', filename + '.rdp'])) + # tools.addTaskToWait(subprocess.Popen(['open', filename + '.rdp'])) # Force MSRDP to be used with -a (thanks to Dani Torregrosa @danitorregrosa (https://github.com/danitorregrosa) ) - tools.add_task_to_wait( - subprocess.Popen( # nosec No user input here + tools.addTaskToWait( + subprocess.Popen( [ 'open', '-a', @@ -115,7 +116,7 @@ if executable in (msrdc, msrdc_localized): ] ) ) - tools.register_for_delayed_deletion(filename + '.rdp') + tools.addFileToUnlink(filename + '.rdp') elif executable == xfreerdp: # Fix resolution... try: @@ -127,4 +128,4 @@ elif executable == xfreerdp: os.path.expandvars(i) for i in [executable] + xfparms + ['/v:{}'.format(address)] ] - subprocess.Popen(params) # nosec No user input here + subprocess.Popen(params) diff --git a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py.signature b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py.signature index e5af7d936..a9f656bf7 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py.signature +++ b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py.signature @@ -1 +1 @@ -afcZlfy6AlFKjQ+1L2q/ETh6YVxUL9RiyiNogPxZhKgt6NMsBcD+2ASw3Up1NqC4yHYNc3DhhIeQ2Vh4as1z+R+1qDdJW3FflPBXZi4Ugv5xx3GoNqISlbkd5U6/O/07XDXp1k8QdObTVH9nUkwlKn7cPdR1hB20HOAl6IhTur4UK7l9dHOcMoZ0aXp4ayqWcAQdBWXwaN/u0/406MLBEdt2hPndNQgu4xXsrACCJMgKWp1+m+tZ/QL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xMcgr8X9m8NqwI6yn+qK96/6+NqfqUJ01h2/A7jta+7dze7c8= \ No newline at end of file diff --git a/server/src/uds/transports/RDP/scripts/windows/direct.py b/server/src/uds/transports/RDP/scripts/windows/direct.py index 5d8df0b9f..88c373782 100644 --- a/server/src/uds/transports/RDP/scripts/windows/direct.py +++ b/server/src/uds/transports/RDP/scripts/windows/direct.py @@ -33,12 +33,12 @@ try: wreg.SetValueEx(key, sp['ip'], 0, wreg.REG_DWORD, 255) # type: ignore wreg.CloseKey(key) # type: ignore except Exception as e: # nosec: Not really interested in the exception - # logger.warning('Exception fixing redirection dialog: %s', e) + # logger.warn('Exception fixing redirection dialog: %s', e) pass # Key does not exists, ok... # 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 = sp['as_file'].format(password=password) # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) if sp['optimize_teams'] == True: # type: ignore try: @@ -46,13 +46,13 @@ if sp['optimize_teams'] == True: # type: ignore h = wreg.OpenKey(wreg.HKEY_CLASSES_ROOT, '.rdp\\OpenWithProgids', 0, wreg.KEY_READ) # type: ignore h.Close() except Exception: - raise Exception('Required Microsoft RDP Client is not found. Please, install it from Microsoft store.') + raise Exception('Required Microsoft Remote Desktop Application is not found. Please, install it from Microsoft store.') # Add .rdp to filename for open with os.rename(filename, filename + '.rdp') filename = filename + '.rdp' os.startfile(filename) # type: ignore # nosec else: - executable = tools.find_application('mstsc.exe') + executable = tools.findApp('mstsc.exe') if executable is None: raise Exception( 'Unable to find mstsc.exe. Check that path points to your SYSTEM32 folder' @@ -60,4 +60,4 @@ else: subprocess.Popen([executable, filename]) # nosec -tools.register_for_delayed_deletion(filename) +# tools.addFileToUnlink(filename) diff --git a/server/src/uds/transports/RDP/scripts/windows/direct.py.signature b/server/src/uds/transports/RDP/scripts/windows/direct.py.signature index 209e0c343..cff0af817 100644 --- a/server/src/uds/transports/RDP/scripts/windows/direct.py.signature +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gTcTGyJuJMfGTGlgNkzRG491vpn6RtvsStxtzinZ72lgwLkaj5iaO1395BZhS/YI3KMDiLHLzcmgSPJ0aRTOM3oF/zIa4Tiy/LzRckIfB3TGHHeXguT2ugmeRM/z+yqcigW1uUKLzIv8FmIDurFj3swGBgHeg/cPbVZ5gy+NQtGFkK1BlpNnm5J/RBUNRbGZ2tn912CoZNaNj+rgKKrNNU85REx4nzq9MJGQm09s3Jk2v0NTDvDbxEy4Y6rr5GLvCvip0ede19Fi/ASG7pFZ1Tasp26IGvcHXRsR4d3wj2bNbJ97RLNjvdT1+5jb5O9kTRcOfz7B3Gbfn9/3wW9sRCbju0CludlZK+cjqo= \ No newline at end of file diff --git a/server/src/uds/transports/RDP/scripts/windows/tunnel.py b/server/src/uds/transports/RDP/scripts/windows/tunnel.py index b27617177..7b1902d81 100644 --- a/server/src/uds/transports/RDP/scripts/windows/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/windows/tunnel.py @@ -1,5 +1,4 @@ -import os -import subprocess # nosec +import subprocess import win32crypt # type: ignore import codecs @@ -17,51 +16,46 @@ fs = forward(remote=(sp['tunHost'], int(sp['tunPort'])), ticket=sp['ticket'], ti # Check that tunnel works.. if fs.check() is False: - raise Exception('

Could not connect to tunnel server.

Please, check your network settings.

') + raise Exception( + '

Could not connect to tunnel server.

Please, check your network settings.

' + ) thePass = sp['password'].encode('UTF-16LE') # type: ignore try: - password = codecs.encode(win32crypt.CryptProtectData(thePass, None, None, None, None, 0x01), 'hex').decode() + password = codecs.encode( + win32crypt.CryptProtectData(thePass, None, None, None, None, 0x01), 'hex' + ).decode() except Exception: # Cannot encrypt for user, trying for machine - password = codecs.encode(win32crypt.CryptProtectData(thePass, None, None, None, None, 0x05), 'hex').decode() - -try: - key = wreg.OpenKey( # type: ignore - wreg.HKEY_CURRENT_USER, # type: ignore - 'Software\\Microsoft\\Terminal Server Client\\LocalDevices', - 0, - wreg.KEY_SET_VALUE, # type: ignore - ) - wreg.SetValueEx(key, '127.0.0.1', 0, wreg.REG_DWORD, 255) # type: ignore - wreg.CloseKey(key) # type: ignore -except Exception as e: # nosec: Not really interested in the exception - # logger.warning('Exception fixing redirection dialog: %s', e) - pass # Key does not exists, but it's ok + password = codecs.encode( + win32crypt.CryptProtectData(thePass, None, None, None, None, 0x05), 'hex' + ).decode() # 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 = sp['as_file'].format( # type: ignore password=password, address='127.0.0.1:{}'.format(fs.server_address[1]) ) -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) +executable = tools.findApp('mstsc.exe') +if executable is None: + raise Exception( + 'Unable to find mstsc.exe. Check that path points to your SYSTEM32 folder' + ) -if sp['optimize_teams']: # type: ignore - try: - h = wreg.OpenKey(wreg.HKEY_CLASSES_ROOT, '.rdp\OpenWithProgids', 0, wreg.KEY_READ) # type: ignore - h.Close() - except Exception: - raise Exception('

Required Microsoft RDP Client is not found.

Please, install it from Microsoft store.

') - # Add .rdp to filename for open with - os.rename(filename, filename + '.rdp') - filename = filename + '.rdp' - os.startfile(filename) # type: ignore # nosec -else: - executable = tools.find_application('mstsc.exe') - if executable is None: - raise Exception('Unable to find mstsc.exe. Check that path points to your SYSTEM32 folder') +try: + key = wreg.OpenKey( + wreg.HKEY_CURRENT_USER, + 'Software\\Microsoft\\Terminal Server Client\\LocalDevices', + 0, + wreg.KEY_SET_VALUE, + ) + wreg.SetValueEx(key, '127.0.0.1', 0, wreg.REG_DWORD, 255) # type: ignore + wreg.CloseKey(key) +except Exception as e: + # logger.warn('Exception fixing redirection dialog: %s', e) + pass # Key does not exists, but it's ok - subprocess.Popen([executable, filename]) # nosec - -# tools.register_for_delayed_deletion(filename) +subprocess.Popen([executable, filename]) +tools.addFileToUnlink(filename) diff --git a/server/src/uds/transports/RDP/scripts/windows/tunnel.py.signature b/server/src/uds/transports/RDP/scripts/windows/tunnel.py.signature index 13616f6e7..c8c8d3d6e 100644 --- a/server/src/uds/transports/RDP/scripts/windows/tunnel.py.signature +++ b/server/src/uds/transports/RDP/scripts/windows/tunnel.py.signature @@ -1 +1 @@ -eHKMYlFbMlB2nHiEgUIT7s/QLhaoO7RAyCIOJsD2IkZ+MRC8xoa7DgOwOabvwfpd6fCV6ThHhlpZxIs3L0yqYUmPacygsmgIKPhdyvHaEAV4+mYsppl4k+Zwemg6USo7aVqdJHcCJzkC1mmYKmS7xd7R+foWu5Nd900RS0DlEkOSKWHf1M/gPE7CSPiiS/saq9CJ72GZ9Lu3wifCfHHiM6WJz3vZSdLSJETMmIrF9GUfEI6H7kbHiPsYh3gp7TtvkAm9Nkn/q9x8HoX6L/SEWyRGYXpNTsxcOFQE/Nqc18Lcx87xIRCzI+Tv4xtbtrNxlhTOyhSqsJA+IHEQ3w0wQVisz5ahB2lwq9002u2cOsYJ5AQVknyjhG8DVX+wJbZUmziCBo4yCcx62IrKibsSbB6vsAcnoekz6AWlgDsZdi7dbGGHALV+5iq9ry12wnLPKUFIFazpsywpshnkqYxMDFYYjOKldd0qT8UDh/gMs3SNXpoMVnUg9o1dCObqnGUY2oAZjWAIpb38l9f8KLkGXk1zHts/v7LSM5ayjZSuQU2T8ALxEygUjmEeQv52NVQ9CNyutfNcsY7xs2ZI3jUBU5uVMc6P17IjZ2wxVt+DPTUsyDrT3IRoWTf/hSzdu77zBkbInY7GFfIFAsg2mn6is5bTmva0E/F3MhP8yvt7H4s= \ No newline at end of file +RkbX3fRuVnznJL4dv27wDJw+x4T6kegHOPRrMF04TunfV+jQr6RBK1vqt6YqLL0FccxT7JLv/kHJJOkT5b//IYS9TIt/M5DdJtg/WaNpsPsaNRBIU8QiaF9zTcNnvz8Rc4XY7infR9puSwbMvEznoUovAd2YUEvj7MHWKozieQQpG/UBECUKFad+S5TgmXmC4RGBSf9Da3x+jvQ45VkhYIWvrfw5xd8dNGwCCJjohc49YvNxGguNWwa/1zB2SY6XjbDd+inHZ+13IR917uU7qYu44UlAUUW9Uazav2XNLOmLoBaDiWUy4hDM4CNvqlQeau8Ppq0SnhiGrvq9/MEbdOeHOMHJqXalA0pLCqTPj/4/4hqQw4POMNEWqAjMA59iGSe/8F9RSPPXHp1mYoQasDalSGoZEPVRYOZUlIECpKMEVCredFK7Vu9sy+yL+2amFr47L9aRNVpaVMwAyP3TukH1/SGL7lPxQXIzu2hoFd6kGLlyBF0CBbKTX9Xlk76fEObN/3dHfDEuK1O+OiwVyX3YMurH4fxvABqMJqRtT1ASSfjLXpKohIGEpUSWNkh2mu5a3OL6lLQxxwDY6WieKQtvJgPiPAOJRVk06CLOSRy7ghaCYH9yn6tShCPTAnRJmGLuttU4mt5fKOC6cHH8GJahRi5FtSuzLigszL5bCaY= \ No newline at end of file diff --git a/server/src/uds/transports/SPICE/scripts/linux/direct.py b/server/src/uds/transports/SPICE/scripts/linux/direct.py index 0c7f2ee51..62e527329 100644 --- a/server/src/uds/transports/SPICE/scripts/linux/direct.py +++ b/server/src/uds/transports/SPICE/scripts/linux/direct.py @@ -7,7 +7,7 @@ import subprocess from uds import tools # type: ignore -executable = tools.find_application('remote-viewer') +executable = tools.findApp('remote-viewer') if executable is None: raise Exception( @@ -20,6 +20,6 @@ if executable is None: theFile = sp['as_file'] # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) subprocess.Popen([executable, filename]) diff --git a/server/src/uds/transports/SPICE/scripts/linux/tunnel.py b/server/src/uds/transports/SPICE/scripts/linux/tunnel.py index 775f13b5b..05133f562 100644 --- a/server/src/uds/transports/SPICE/scripts/linux/tunnel.py +++ b/server/src/uds/transports/SPICE/scripts/linux/tunnel.py @@ -8,7 +8,7 @@ import subprocess from uds import tools # type: ignore from uds.tunnel import forward # type: ignore -executable = tools.find_application('remote-viewer') +executable = tools.findApp('remote-viewer') if executable is None: raise Exception( @@ -52,5 +52,5 @@ theFile = theFile.format( port='-1' if not fs else fs.server_address[1], ) -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) subprocess.Popen([executable, filename]) diff --git a/server/src/uds/transports/SPICE/scripts/macosx/direct.py b/server/src/uds/transports/SPICE/scripts/macosx/direct.py index 5950d5e47..3f601b961 100644 --- a/server/src/uds/transports/SPICE/scripts/macosx/direct.py +++ b/server/src/uds/transports/SPICE/scripts/macosx/direct.py @@ -29,6 +29,6 @@ if not os.path.isfile(remoteViewer): theFile = sp['as_file'] # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) subprocess.Popen([remoteViewer, filename]) diff --git a/server/src/uds/transports/SPICE/scripts/macosx/tunnel.py b/server/src/uds/transports/SPICE/scripts/macosx/tunnel.py index d7a134d03..42c931325 100644 --- a/server/src/uds/transports/SPICE/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/SPICE/scripts/macosx/tunnel.py @@ -56,5 +56,5 @@ theFile = theFile.format( port='-1' if not fs else fs.server_address[1], ) -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) subprocess.Popen([remoteViewer, filename]) diff --git a/server/src/uds/transports/SPICE/scripts/windows/direct.py b/server/src/uds/transports/SPICE/scripts/windows/direct.py index 49d24945a..446b0594c 100644 --- a/server/src/uds/transports/SPICE/scripts/windows/direct.py +++ b/server/src/uds/transports/SPICE/scripts/windows/direct.py @@ -16,7 +16,7 @@ for env in ('PROGRAMFILES', 'PROGRAMW6432'): if env in os.environ: extraPaths += tuple(p + '\\bin' for p in glob.glob(os.environ[env] + '\\VirtViewer*')) # type: ignore -executable = tools.find_application('remote-viewer.exe', extraPaths) +executable = tools.findApp('remote-viewer.exe', extraPaths) if executable is None: raise Exception( @@ -32,6 +32,6 @@ if executable is None: theFile = sp['as_file'] # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) subprocess.Popen([executable, filename]) diff --git a/server/src/uds/transports/SPICE/scripts/windows/tunnel.py b/server/src/uds/transports/SPICE/scripts/windows/tunnel.py index 4e32ca880..4a1ae37b2 100644 --- a/server/src/uds/transports/SPICE/scripts/windows/tunnel.py +++ b/server/src/uds/transports/SPICE/scripts/windows/tunnel.py @@ -17,7 +17,7 @@ for env in ('PROGRAMFILES', 'PROGRAMW6432'): if env in os.environ: extraPaths += tuple(p + '\\bin' for p in glob.glob(os.environ[env] + '\\VirtViewer*')) # type: ignore -executable = tools.find_application('remote-viewer.exe', extraPaths) +executable = tools.findApp('remote-viewer.exe', extraPaths) if executable is None: raise Exception( @@ -59,6 +59,6 @@ theFile = theFile.format( port='-1' if not fs else fs.server_address[1], ) -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) subprocess.Popen([executable, filename]) diff --git a/server/src/uds/transports/X2GO/scripts/linux/direct.py b/server/src/uds/transports/X2GO/scripts/linux/direct.py index 7d32c8530..404d13419 100644 --- a/server/src/uds/transports/X2GO/scripts/linux/direct.py +++ b/server/src/uds/transports/X2GO/scripts/linux/direct.py @@ -9,13 +9,13 @@ from os.path import expanduser from uds import tools # type: ignore home = expanduser('~') + ':1;/media:1;' -keyFile = tools.save_temp_file(sp['key']) # type: ignore +keyFile = tools.saveTempFile(sp['key']) # type: ignore theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip=sp['ip'], port=sp['port']) # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) # HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session -executable = tools.find_application('x2goclient') +executable = tools.findApp('x2goclient') if executable is None: raise Exception( '''

You must have installed latest X2GO Client in order to connect to this UDS service.

@@ -33,5 +33,5 @@ subprocess.Popen( '--add-to-known-hosts', ] ) -# tools.register_for_delayed_deletion(filename) -# tools.register_for_delayed_deletion(keyFile) +# tools.addFileToUnlink(filename) +# tools.addFileToUnlink(keyFile) diff --git a/server/src/uds/transports/X2GO/scripts/linux/tunnel.py b/server/src/uds/transports/X2GO/scripts/linux/tunnel.py index 8b83da4ee..4c348461e 100644 --- a/server/src/uds/transports/X2GO/scripts/linux/tunnel.py +++ b/server/src/uds/transports/X2GO/scripts/linux/tunnel.py @@ -20,13 +20,13 @@ if fs.check() is False: ) home = expanduser('~') + ':1;/media:1;' -keyFile = tools.save_temp_file(sp['key']) # type: ignore +keyFile = tools.saveTempFile(sp['key']) # type: ignore theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip='127.0.0.1', port=fs.server_address[1]) # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) # HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session -executable = tools.find_application('x2goclient') +executable = tools.findApp('x2goclient') if executable is None: raise Exception( '''

You must have installed latest X2GO Client in order to connect to this UDS service.

diff --git a/server/src/uds/transports/X2GO/scripts/windows/direct.py b/server/src/uds/transports/X2GO/scripts/windows/direct.py index 851825837..71b638426 100644 --- a/server/src/uds/transports/X2GO/scripts/windows/direct.py +++ b/server/src/uds/transports/X2GO/scripts/windows/direct.py @@ -10,13 +10,13 @@ from os.path import expanduser from uds import tools # type: ignore home = expanduser('~').replace('\\', '\\\\') + '#1;' -keyFile = tools.save_temp_file(sp['key']) # type: ignore +keyFile = tools.saveTempFile(sp['key']) # type: ignore # On windows, the separator beween active and not is "#" theFile = sp['xf'].format(export='c:\\\\#1;', keyFile=keyFile.replace('\\', '/'), ip=sp['ip'], port=sp['port']) # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) x2goPath = os.environ['PROGRAMFILES(X86)'] + '\\x2goclient' -executable = tools.find_application('x2goclient.exe', [x2goPath]) +executable = tools.findApp('x2goclient.exe', [x2goPath]) if executable is None: raise Exception( '''

You must have installed latest X2GO Client in order to connect to this UDS service.

@@ -36,5 +36,5 @@ subprocess.Popen( '--add-to-known-hosts', ] ) -# tools.register_for_delayed_deletion(filename) -# tools.register_for_delayed_deletion(keyFile) +# tools.addFileToUnlink(filename) +# tools.addFileToUnlink(keyFile) diff --git a/server/src/uds/transports/X2GO/scripts/windows/tunnel.py b/server/src/uds/transports/X2GO/scripts/windows/tunnel.py index 715f05079..b7b79750e 100644 --- a/server/src/uds/transports/X2GO/scripts/windows/tunnel.py +++ b/server/src/uds/transports/X2GO/scripts/windows/tunnel.py @@ -22,12 +22,12 @@ if fs.check() is False: # Care, expanduser is encoding using "mcbs", so treat it as bytes on python 2.7 home = expanduser('~').replace('\\', '\\\\') + '#1;' -keyFile = tools.save_temp_file(sp['key']) # type: ignore +keyFile = tools.saveTempFile(sp['key']) # type: ignore theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip='127.0.0.1', port=fs.server_address[1]) # type: ignore -filename = tools.save_temp_file(theFile) +filename = tools.saveTempFile(theFile) x2goPath = os.environ['PROGRAMFILES(X86)'] + '\\x2goclient' -executable = tools.find_application('x2goclient.exe', [x2goPath]) +executable = tools.findApp('x2goclient.exe', [x2goPath]) if executable is None: raise Exception( '''

You must have installed latest X2GO Client in default program file folder in order to connect to this UDS service.