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

Moving to new method names. Client keeps backwards compat

This commit is contained in:
Adolfo Gómez García 2024-03-05 04:15:32 +01:00
parent 16e99aad1d
commit 2d40b5ea5b
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
16 changed files with 42 additions and 42 deletions

View File

@ -23,8 +23,8 @@ def execNewXFreeRdp(xfreerdp):
# Try to locate a xfreerdp and udsrdp. udsrdp will be used if found.
xfreerdp = tools.findApp('xfreerdp')
udsrdp = tools.findApp('udsrdp')
xfreerdp = tools.find_application('xfreerdp')
udsrdp = tools.find_application('udsrdp')
fnc, app = None, None
if xfreerdp:

View File

@ -25,8 +25,8 @@ def execNewXFreeRdp(xfreerdp, port):
# Try to locate a xfreerdp and udsrdp. udsrdp will be used if found.
xfreerdp = tools.findApp('xfreerdp')
udsrdp = tools.findApp('udsrdp')
xfreerdp = tools.find_application('xfreerdp')
udsrdp = tools.find_application('udsrdp')
fnc, app = None, None
if xfreerdp:

View File

@ -16,7 +16,7 @@ msrdc_localized = (
)
# msrdc_app = '/Contents/MacOS/Microsoft Remote Desktop'
xfreerdp = tools.findApp('xfreerdp')
xfreerdp = tools.find_application('xfreerdp')
executable = None
@ -85,7 +85,7 @@ if executable is None:
)
if executable in (msrdc, msrdc_localized):
theFile = sp['as_file'] # type: ignore
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
# Rename as .rdp, so open recognizes it
shutil.move(filename, filename + '.rdp')
@ -101,7 +101,7 @@ if executable in (msrdc, msrdc_localized):
]
)
)
tools.addFileToUnlink(filename + '.rdp')
tools.register_for_delayed_deletion(filename + '.rdp')
elif executable == xfreerdp:
# Fix resolution...
try:

View File

@ -38,7 +38,7 @@ msrdc_localized = (
'/Applications/Microsoft Remote Desktop.localized/Microsoft Remote Desktop.app'
)
xfreerdp = tools.findApp('xfreerdp')
xfreerdp = tools.find_application('xfreerdp')
executable = None
# Check first xfreerdp, allow password redir
@ -99,7 +99,7 @@ if fs.check() is False:
if executable in (msrdc, msrdc_localized):
theFile = theFile = sp['as_file'].format(address=address) # type: ignore
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
# Rename as .rdp, so open recognizes it
shutil.move(filename, filename + '.rdp')
@ -115,7 +115,7 @@ if executable in (msrdc, msrdc_localized):
]
)
)
tools.addFileToUnlink(filename + '.rdp')
tools.register_for_delayed_deletion(filename + '.rdp')
elif executable == xfreerdp:
# Fix resolution...
try:

View File

@ -38,7 +38,7 @@ except Exception as e: # nosec: Not really interested in the exception
# 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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
if sp['optimize_teams'] == True: # type: ignore
try:
@ -52,7 +52,7 @@ if sp['optimize_teams'] == True: # type: ignore
filename = filename + '.rdp'
os.startfile(filename) # type: ignore # nosec
else:
executable = tools.findApp('mstsc.exe')
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'
@ -60,4 +60,4 @@ else:
subprocess.Popen([executable, filename]) # nosec
tools.addFileToUnlink(filename)
tools.register_for_delayed_deletion(filename)

View File

@ -45,7 +45,7 @@ theFile = sp['as_file'].format( # type: ignore
password=password, address='127.0.0.1:{}'.format(fs.server_address[1])
)
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
if sp['optimize_teams']: # type: ignore
try:
@ -58,10 +58,10 @@ if sp['optimize_teams']: # type: ignore
filename = filename + '.rdp'
os.startfile(filename) # type: ignore # nosec
else:
executable = tools.findApp('mstsc.exe')
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')
subprocess.Popen([executable, filename]) # nosec
# tools.addFileToUnlink(filename)
# tools.register_for_delayed_deletion(filename)

View File

@ -7,7 +7,7 @@ import subprocess
from uds import tools # type: ignore
executable = tools.findApp('remote-viewer')
executable = tools.find_application('remote-viewer')
if executable is None:
raise Exception(
@ -20,6 +20,6 @@ if executable is None:
theFile = sp['as_file'] # type: ignore
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
subprocess.Popen([executable, filename])

View File

@ -8,7 +8,7 @@ import subprocess
from uds import tools # type: ignore
from uds.tunnel import forward # type: ignore
executable = tools.findApp('remote-viewer')
executable = tools.find_application('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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
subprocess.Popen([executable, filename])

View File

@ -29,6 +29,6 @@ if not os.path.isfile(remoteViewer):
theFile = sp['as_file'] # type: ignore
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
subprocess.Popen([remoteViewer, filename])

View File

@ -56,5 +56,5 @@ theFile = theFile.format(
port='-1' if not fs else fs.server_address[1],
)
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
subprocess.Popen([remoteViewer, filename])

View File

@ -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.findApp('remote-viewer.exe', extraPaths)
executable = tools.find_application('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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
subprocess.Popen([executable, filename])

View File

@ -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.findApp('remote-viewer.exe', extraPaths)
executable = tools.find_application('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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
subprocess.Popen([executable, filename])

View File

@ -9,13 +9,13 @@ from os.path import expanduser
from uds import tools # type: ignore
home = expanduser('~') + ':1;/media:1;'
keyFile = tools.saveTempFile(sp['key']) # type: ignore
keyFile = tools.save_temp_file(sp['key']) # type: ignore
theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip=sp['ip'], port=sp['port']) # type: ignore
filename = tools.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
# HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session
executable = tools.findApp('x2goclient')
executable = tools.find_application('x2goclient')
if executable is None:
raise Exception(
'''<p>You must have installed latest X2GO Client in order to connect to this UDS service.</p>
@ -33,5 +33,5 @@ subprocess.Popen(
'--add-to-known-hosts',
]
)
# tools.addFileToUnlink(filename)
# tools.addFileToUnlink(keyFile)
# tools.register_for_delayed_deletion(filename)
# tools.register_for_delayed_deletion(keyFile)

View File

@ -20,13 +20,13 @@ if fs.check() is False:
)
home = expanduser('~') + ':1;/media:1;'
keyFile = tools.saveTempFile(sp['key']) # type: ignore
keyFile = tools.save_temp_file(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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
# HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session
executable = tools.findApp('x2goclient')
executable = tools.find_application('x2goclient')
if executable is None:
raise Exception(
'''<p>You must have installed latest X2GO Client in order to connect to this UDS service.</p>

View File

@ -10,13 +10,13 @@ from os.path import expanduser
from uds import tools # type: ignore
home = expanduser('~').replace('\\', '\\\\') + '#1;'
keyFile = tools.saveTempFile(sp['key']) # type: ignore
keyFile = tools.save_temp_file(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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
x2goPath = os.environ['PROGRAMFILES(X86)'] + '\\x2goclient'
executable = tools.findApp('x2goclient.exe', [x2goPath])
executable = tools.find_application('x2goclient.exe', [x2goPath])
if executable is None:
raise Exception(
'''<p>You must have installed latest X2GO Client in order to connect to this UDS service.</p>
@ -36,5 +36,5 @@ subprocess.Popen(
'--add-to-known-hosts',
]
)
# tools.addFileToUnlink(filename)
# tools.addFileToUnlink(keyFile)
# tools.register_for_delayed_deletion(filename)
# tools.register_for_delayed_deletion(keyFile)

View File

@ -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.saveTempFile(sp['key']) # type: ignore
keyFile = tools.save_temp_file(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.saveTempFile(theFile)
filename = tools.save_temp_file(theFile)
x2goPath = os.environ['PROGRAMFILES(X86)'] + '\\x2goclient'
executable = tools.findApp('x2goclient.exe', [x2goPath])
executable = tools.find_application('x2goclient.exe', [x2goPath])
if executable is None:
raise Exception(
'''<p>You must have installed latest X2GO Client in default program file folder in order to connect to this UDS service.</p>