From 9c4a4ed35c284e3d8c602243042e92c0205d61be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 1 Jul 2021 21:38:21 +0200 Subject: [PATCH] Fixed RDP for MacOS --- .../src/uds/transports/RDP/scripts/macosx/direct.py | 11 +++++++---- .../transports/RDP/scripts/macosx/direct.py.signature | 2 +- .../src/uds/transports/RDP/scripts/macosx/tunnel.py | 11 +++++++---- .../transports/RDP/scripts/macosx/tunnel.py.signature | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/server/src/uds/transports/RDP/scripts/macosx/direct.py b/server/src/uds/transports/RDP/scripts/macosx/direct.py index 257fbd02..1234bb13 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/direct.py +++ b/server/src/uds/transports/RDP/scripts/macosx/direct.py @@ -21,14 +21,17 @@ def fixResolution(): import re import subprocess results = str(subprocess.Popen(['system_profiler SPDisplaysDataType'],stdout=subprocess.PIPE, shell=True).communicate()[0]) - res = re.search(r': \d* x \d*', results).group(0).split(' ') - width, height = str(int(res[1])-4), str(int(int(res[3])*90/100)) # Width and Height + groups = re.search(r': \d* x \d*', results) + width, height = '1024', '768' # Safe default values + if groups: + res = groups.group(0).split(' ') + width, height = str(int(res[1])-4), str(int(int(res[3])*90/100)) # Width and Height 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): +if xfreerdp and os.path.isfile(xfreerdp): executable = xfreerdp -elif os.path.isfile(msrdc) and sp['as_file']: # type: ignore +elif msrdc and os.path.isfile(msrdc) and sp['as_file']: # type: ignore executable = msrdc if executable is None: 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 31c4bbbc..c6f8c6c7 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 @@ -PFhjbkT6+Xgiq/hHE10L5KdkDFhpp4wlRUBSEvUKO0Ral/+xB/La2AUUXVwyIZrIcy9oXZ3mzlOLfzCSa9jcqpR8X3twmtqSz7mDL166avrRGSWkRXS6VFSOt2mjeAPt/pCvB3IIz+KoluMJBtaYj4JTqGzu85t9REfHwv9BF7MarMStUcrXov8tL+04sH1Ge6/daey3Y3VkdLkel2VeMaQmfhwuIcHoNQhSXHKX6Jjdtv0Vzf9Pi3Va7CK+uR4rQK0etQTP6GVmX7veJdWbZM4x81136rD1yWIdFPTcy9NnhBbBtgZiIS8eKSXzDwC1ReJq++nclyxlbPD3JJPYZ8TNBfS0LStR8kpz4TTBj7uLJzXrBselIt4Io7w1QaLvOmDEEs1wcfvmSImvNHCFu1giPQRPrzaoeq9tJyin0xb2dZQNqDlptyCZZkEFOOfIhI3dYVeL38ljhpBo4wcQ2fI1kmhAuc2yZgNnhVRj2qJePCUTxmhQXuT9OKIF8YKlG0SaNIFszRG+qRxJ0G/S4MkPTjJsHXKq+qh2zilimJhJLherackXIG0aY5mkMFZ2zGrQgzy271zFNtOjUen8KTXkvrd2ZqxXYdJeu7PM3UxuLH5Cx3vnbf+/cXHXXqs5p5iBWqogsQZHkiKVod2S7FE+TmIQIaphwyd+lvy6iOE= \ No newline at end of file +g+F+FrlpXOyy2wh+BlNM/jao56WCwLWsE1ilao7muUhTCcLJGWGWpLvPkf41ooKcFMX06m0b0tIY/I7am3w20WJ/J2TwGx6iekjUwNnHu12cBXUgmlJP2oYuqIMkVIvkFT6PjTi8163+gYPufVidhQPBFCz+4LnHI5Lj/7AUPonBdf4iHpTbVAQ4g3tf4KPgQPKX6O9PuCSWOyetZZXy9LJc1IqAnRSnjCRXbUHUc/AFRZ4ERAKD1fgEGezbvtdI5C0j/umr4hQYlMlzuL63N76HI2K3c1+Nwr055WyxDtjiPECo77glJPScUe5VoI35Lvd1YQ2nlOsHpj4d9u+mOyV8InCEOEqkllw+Z3QeKeWm15PIqcLN8DpU2f8zwTi3dsSAWY64YE9iQ9VZGtLmBqo5zuel+p9N2Rutu8shI6hIr2Ivq7VFqyWhDAGcR0FoXKUtK9XFC0klbTeHPnuDkl5UdKkhyBNykYX3f367tcWA8nmC8W6tHxKkGncwTSQS0nrF3ITVwQn+ldGgRD0KrkmNx/uB6dexcEFSEuFvA8YXENmqshNgo0AeTRIVxjqp2/MrddrETduBh4+bG32VhLN82POJj61CpPRizNp4K2Nx9zdBsPdbSTUZZSN6XkNNEm+qNCbtIqdtbptN11Y/NH9L8x1Kd/O6QnMWqj9i8og= \ 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 74f8b3b4..0b3282a4 100644 --- a/server/src/uds/transports/RDP/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/RDP/scripts/macosx/tunnel.py @@ -19,8 +19,11 @@ def fixResolution(): import re import subprocess results = str(subprocess.Popen(['system_profiler SPDisplaysDataType'],stdout=subprocess.PIPE, shell=True).communicate()[0]) - res = re.search(r': \d* x \d*', results).group(0).split(' ') - width, height = str(int(res[1])-4), str(int(int(res[3])*90/100)) # Width and Height + groups = re.search(r': \d* x \d*', results) + width, height = '1024', '768' # Safe default values + if groups: + res = groups.group(0).split(' ') + width, height = str(int(res[1])-4), str(int(int(res[3])*90/100)) # Width and Height return list(map(lambda x: x.replace('#WIDTH#', width).replace('#HEIGHT#', height), sp['as_new_xfreerdp_params'])) # type: ignore @@ -29,9 +32,9 @@ xfreerdp = tools.findApp('xfreerdp') executable = None # Check first xfreerdp, allow password redir -if os.path.isfile(xfreerdp): +if xfreerdp and os.path.isfile(xfreerdp): executable = xfreerdp -elif os.path.isfile(msrdc) and sp['as_file']: # type: ignore +elif msrdc and os.path.isfile(msrdc) and sp['as_file']: # type: ignore executable = msrdc if executable is None: 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 b0903117..5fdc2471 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 @@ -F5BEzwTWBoM12XfwvA70K8cgB8sxXrE9APZuvHhPTpJY9+TA3+Q4wnmC+yrbUW54wPS4HPSrDkERUVDHGmulIeLuOzXnmAA1C+L86FOkO5Pmiy/10utA44p8fja/3R6K5yGW2i9tDSg5CBalaVixw0YvxKZgDpLmdL7cd5h2aWliJc68nOoDMdduWz3Tt19tyMO7TRLfhCVJUP9ETStPIHoLLr/NiyeZ6y7/KvARoi5vEQ1XkRZhOoiZoSnOPCBihzXNIoVAPDFwcS2vW8j+u8TgdFeMgLz26ANs4VLslbhMqJfNTTueejGTma9POOXgDMcbAVbhBCk9xuZjieho/QdtaEQOgPnR45JfadUm0QvrNquVW6eKeE9K6VJ/o3EF5u4qSRoSTlDbxlBo5wblnrRj2IWScvSHGpzTto1o81zOMb8KLhK0iJggxWdK6IiRGmUMbiUKAjeXR3ufvoiQpU9gB54FbPWOThenKL3zUWamVTSx7HnleDSUn+Q9Xu1KWqCamagdgBG7MkEJFkd3dChzaxR2GNBRAijHhHF31AlFcdsIfPXsokqDbqtDu92oSj9MRfjDhp9Jwrw7De4CRXHbmaBYjXfcBTomQYjVymU+cyNjyfgt1NHHWkmVoYvHxod+cUAE5ORkrD9iwZsBbzwYMgcO0TPCqcmNMOS0Mto= \ No newline at end of file +fhYPwbna6zRkxA4oceHtAAbAglnf3zEr+9GzswklGScMNTjEAlF6LPw+0pPQkrgXCn6+SVxdferandVfxYyQwdmU4d0xEHhW5hVe38vKgFVYqqZxtaOfLP6feAuAYyblmE82Zk4gJB7nhTLRcub0i45de2aEtfPoi7vtqHDeTdZIcY38rddhjqtqTw/yEfzJHeW3/7sKxnrXKjFkMPcPvH+1X9OOoYpqp7RZvZyhHbtxJQVxy9wZ4PVFR2KvcNl/rg9h9uu6AnOopoC/vyMQXF+nS3E/bAR2pjoZ6Gld+5VqdgLReWhIxm7fHlvM11D57j/GmKTP1v6UOT6DifX/Ot011nATxy7SauK1VYYuyEZe8oCG5lv1EkLQYw3O7jhFog1o9Lqr/CBl5oov/l9VXceDYoMho75qXFS3XU/bCibe6sbfz31DJUzl6qf64cWXrVQMTtSSj/ChFBSwhm0R/u78w8HE/Gl1JjEBHAD/zNAzhd24B815anE16geye2fYJchnCnHDRj5FrHHwBnQtnLJ8crR8/qRJl6s+S2cCUy08kN+tOpujFY4eYihsxoxeSJB3yCO4WFuZZRI9x/TCs0aTXblzlGl3QCmXWgbjdTwCqnMqYhlzabxH2MUp5l7F3/2gX4Vrzqgov6Q70CjOtepE0tI7g+V8n+wl/9pi6RE= \ No newline at end of file