forked from shaba/openuds
fixed RDP transport for 3.0
This commit is contained in:
parent
363d247c8b
commit
4dc4c27925
@ -122,29 +122,6 @@ class RDPTransport(BaseRDPTransport):
|
||||
r.printerString = self.printerString.value
|
||||
r.linuxCustomParameters = self.customParameters.value
|
||||
|
||||
# data
|
||||
# data = {
|
||||
# 'os': os['OS'],
|
||||
# 'ip': ip,
|
||||
# 'port': 3389,
|
||||
# 'username': username,
|
||||
# 'password': password,
|
||||
# 'hasCredentials': username != '' and password != '',
|
||||
# 'domain': domain,
|
||||
# 'width': width,
|
||||
# 'height': height,
|
||||
# 'depth': depth,
|
||||
# 'printers': self.allowPrinters.isTrue(),
|
||||
# 'smartcards': self.allowSmartcards.isTrue(),
|
||||
# 'drives': self.allowDrives.isTrue(),
|
||||
# 'serials': self.allowSerials.isTrue(),
|
||||
# 'compression': True,
|
||||
# 'wallpaper': self.wallpaper.isTrue(),
|
||||
# 'multimon': self.multimon.isTrue(),
|
||||
# 'fullScreen': width == -1 or height == -1,
|
||||
# 'this_server': request.build_absolute_uri('/')
|
||||
# }
|
||||
|
||||
os = {
|
||||
OsDetector.Windows: 'windows',
|
||||
OsDetector.Linux: 'linux',
|
||||
@ -178,6 +155,7 @@ class RDPTransport(BaseRDPTransport):
|
||||
})
|
||||
else: # Mac
|
||||
sp.update({
|
||||
'as_new_xfreerdp_params': r.as_new_xfreerdp_params,
|
||||
'as_file': r.as_file,
|
||||
'as_cord_url': r.as_cord_url,
|
||||
})
|
||||
|
@ -149,34 +149,6 @@ class TRDPTransport(BaseRDPTransport):
|
||||
r.printerString = self.printerString.value
|
||||
r.linuxCustomParameters = self.customParameters.value
|
||||
|
||||
# data
|
||||
# data = {
|
||||
# 'os': os['OS'],
|
||||
# 'ip': ip,
|
||||
# 'tunUser': tunuser,
|
||||
# 'tunPass': tunpass,
|
||||
# 'tunHost': sshHost,
|
||||
# 'tunPort': sshPort,
|
||||
# 'tunWait': self.tunnelWait.num(),
|
||||
# 'username': username,
|
||||
# 'password': password,
|
||||
# 'hasCredentials': username != '' and password != '',
|
||||
# 'domain': domain,
|
||||
# 'width': width,
|
||||
# 'height': height,
|
||||
# 'depth': depth,
|
||||
# 'printers': self.allowPrinters.isTrue(),
|
||||
# 'smartcards': self.allowSmartcards.isTrue(),
|
||||
# 'drives': self.allowDrives.isTrue(),
|
||||
# 'serials': self.allowSerials.isTrue(),
|
||||
# 'compression': True,
|
||||
# 'wallpaper': self.wallpaper.isTrue(),
|
||||
# 'multimon': self.multimon.isTrue(),
|
||||
# 'fullScreen': width == -1 or height == -1,
|
||||
# 'this_server': request.build_absolute_uri('/'),
|
||||
# 'r': r,
|
||||
# }
|
||||
|
||||
os = {
|
||||
OsDetector.Windows: 'windows',
|
||||
OsDetector.Linux: 'linux',
|
||||
@ -209,12 +181,12 @@ class TRDPTransport(BaseRDPTransport):
|
||||
sp.update({
|
||||
'as_new_xfreerdp_params': r.as_new_xfreerdp_params,
|
||||
'as_rdesktop_params': r.as_rdesktop_params,
|
||||
'address': r.address,
|
||||
})
|
||||
else: # Mac
|
||||
sp.update({
|
||||
'as_file': r.as_file,
|
||||
'as_cord_url': r.as_cord_url,
|
||||
'as_new_xfreerdp_params': r.as_new_xfreerdp_params,
|
||||
})
|
||||
if domain != '':
|
||||
sp['usernameWithDomain'] = '{}\\\\{}'.format(domain, username)
|
||||
|
@ -8,23 +8,23 @@ import re
|
||||
|
||||
from uds import tools # @UnresolvedImport
|
||||
|
||||
import six
|
||||
|
||||
# Inject local passed sp into globals for functions
|
||||
globals()['sp'] = sp # @UndefinedVariable
|
||||
|
||||
def execUdsRdp(udsrdp):
|
||||
import subprocess
|
||||
params = [udsrdp] + {m.r.as_new_xfreerdp_params} + ['/v:{m.r.address}'] # @UndefinedVariable
|
||||
# import subprocess # @Reimport
|
||||
params = [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable
|
||||
tools.addTaskToWait(subprocess.Popen(params))
|
||||
|
||||
|
||||
def execNewXFreeRdp(xfreerdp):
|
||||
import subprocess # @Reimport
|
||||
# import subprocess # @Reimport
|
||||
params = [xfreerdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])] # @UndefinedVariable
|
||||
tools.addTaskToWait(subprocess.Popen(params))
|
||||
|
||||
|
||||
def execRdesktop(rdesktop):
|
||||
import subprocess # @Reimport
|
||||
# import subprocess # @Reimport
|
||||
params = [rdesktop] + sp['as_rdesktop_params'] + [sp['address']] # @UndefinedVariable
|
||||
p = subprocess.Popen(params, stdin=subprocess.PIPE)
|
||||
if sp['password'] != '': # @UndefinedVariable
|
||||
|
@ -9,23 +9,20 @@ from uds.forward import forward # @UnresolvedImport
|
||||
|
||||
from uds import tools # @UnresolvedImport
|
||||
|
||||
import six
|
||||
|
||||
# Inject local passed sp into globals for functions
|
||||
globals()['sp'] = sp # @UndefinedVariable
|
||||
|
||||
def execUdsRdp(udsrdp, port):
|
||||
import subprocess
|
||||
params = [udsrdp] + {m.r.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)] # @UndefinedVariable
|
||||
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
|
||||
tools.addTaskToWait(subprocess.Popen(params))
|
||||
|
||||
|
||||
def execRdesktop(rdesktop, port):
|
||||
import subprocess # @Reimport
|
||||
params = [rdesktop] + sp['as_rdesktop_params'] + ['127.0.0.1:{}'.format(port)] # @UndefinedVariable
|
||||
p = subprocess.Popen(params, stdin=subprocess.PIPE)
|
||||
if sp['password'] != '': # @UndefinedVariable
|
||||
|
@ -5,15 +5,12 @@ 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 os
|
||||
import urllib
|
||||
|
||||
from uds import tools # @UnresolvedImport
|
||||
|
||||
theFile = '''{m.r.as_file}'''
|
||||
# Inject local passed sp into globals for functions
|
||||
globals()['sp'] = sp # @UndefinedVariable
|
||||
|
||||
# First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one)
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
msrdc = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection'
|
||||
cord = "/Applications/CoRD.app/Contents/MacOS/CoRD"
|
||||
|
||||
|
@ -5,27 +5,23 @@ 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 os
|
||||
import urllib
|
||||
from uds.forward import forward # @UnresolvedImport
|
||||
|
||||
from uds import tools # @UnresolvedImport
|
||||
|
||||
import six
|
||||
# Inject local passed sp into globals for functions
|
||||
globals()['sp'] = sp # @UndefinedVariable
|
||||
|
||||
# First, try to locate Remote Desktop Connection (version 2, from Microsoft website, not the app store one)
|
||||
msrdc = '/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection'
|
||||
cord = "/Applications/CoRD.app/Contents/MacOS/CoRD"
|
||||
|
||||
if os.path.isfile(msrdc):
|
||||
executable = msrdc
|
||||
elif os.path.isfile(cord):
|
||||
if os.path.isfile(cord):
|
||||
executable = cord
|
||||
elif os.path.isfile(msrdc):
|
||||
executable = msrdc
|
||||
else:
|
||||
executable = None
|
||||
|
||||
|
||||
def onExit():
|
||||
import subprocess # @Reimport
|
||||
subprocess.call(
|
||||
@ -50,23 +46,19 @@ if executable is None:
|
||||
<p>If both apps are installed, Remote Desktop Connection will be used as first option</p>
|
||||
'''.format(sp['this_server'])) # @UndefinedVariable
|
||||
|
||||
forwardThread, port = forward(sp['tunHost'], sp['tunPort'], sp['tunUser'], sp['tunPass'], sp['ip'], 3389, sp['tunWait']) # @UndefinedVariable
|
||||
forwardThread, port = forward(sp['tunHost'], sp['tunPort'], sp['tunUser'], sp['tunPass'], sp['ip'], 3389, waitTime=sp['tunWait']) # @UndefinedVariable
|
||||
address = '127.0.0.1:{}'.format(port)
|
||||
|
||||
if forwardThread.status == 2:
|
||||
raise Exception('Unable to open tunnel')
|
||||
|
||||
else:
|
||||
theFile = '''{m.r.as_file}'''.format(
|
||||
address='127.0.0.1:{{}}'.format(port)
|
||||
)
|
||||
filename = tools.saveTempFile(theFile)
|
||||
tools.addFileToUnlink(filename)
|
||||
|
||||
if executable == msrdc:
|
||||
theFile = sp['as_file'].format(address=address) # @UndefinedVariable
|
||||
filename = tools.saveTempFile(theFile)
|
||||
tools.addFileToUnlink(filename)
|
||||
|
||||
try:
|
||||
filename = tools.saveTempFile(sp['as_file'].format(address=address)) # @UndefinedVariable
|
||||
tools.addFileToUnlink(filename)
|
||||
if sp['password'] != '': # @UndefinedVariable
|
||||
subprocess.call(
|
||||
[
|
||||
|
@ -3,15 +3,14 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# pylint: disable=import-error, no-name-in-module
|
||||
import subprocess
|
||||
import win32crypt # @UnresolvedImport
|
||||
try:
|
||||
import winreg as wreg
|
||||
except ImportError: # Python 2.7 fallback
|
||||
import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error
|
||||
|
||||
import subprocess
|
||||
from uds.log import logger # @UnresolvedImport
|
||||
|
||||
from uds import tools # @UnresolvedImport
|
||||
|
||||
import six
|
||||
@ -32,13 +31,10 @@ except Exception as 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
|
||||
theFile = sp['as_file'].format(# @UndefinedVariable
|
||||
password=password,
|
||||
address=sp['ip']+':'+sp['port'] # @UndefinedVariable
|
||||
password=password
|
||||
)
|
||||
filename = tools.saveTempFile(theFile)
|
||||
executable = tools.findApp('mstsc.exe')
|
||||
|
||||
subprocess.Popen([executable, filename])
|
||||
tools.addFileToUnlink(filename)
|
||||
|
||||
# QtGui.QMessageBox.critical(parent, 'Notice', filename + ", " + executable, QtGui.QMessageBox.Ok)
|
||||
|
@ -4,12 +4,12 @@ from __future__ import unicode_literals
|
||||
|
||||
# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable
|
||||
|
||||
import subprocess
|
||||
import win32crypt # @UnresolvedImport
|
||||
try:
|
||||
import winreg as wreg
|
||||
except ImportError: # Python 2.7 fallback
|
||||
import _winreg as wreg # @UnresolvedImport, pylint: disable=import-error
|
||||
import subprocess
|
||||
from uds.forward import forward # @UnresolvedImport
|
||||
from uds.log import logger # @UnresolvedImport
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user