advancing new transport system
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 536 KiB |
@ -34,20 +34,16 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from uds.core.util import log
|
||||
from uds.core.util.stats import events
|
||||
from django.core.urlresolvers import reverse
|
||||
from uds.REST import Handler
|
||||
from uds.REST import RequestError
|
||||
from uds.models import TicketStore
|
||||
from uds.models import UserService, Transport, ServicePool, User
|
||||
from uds.core.managers.UserServiceManager import UserServiceManager
|
||||
from uds.models import User
|
||||
from uds.web import errors
|
||||
from uds.web.views.service import getService
|
||||
from uds.core.managers import cryptoManager
|
||||
|
||||
|
||||
import datetime
|
||||
import six
|
||||
|
||||
import logging
|
||||
|
@ -108,6 +108,38 @@ class TSRDPTransport(BaseRDPTransport):
|
||||
tunPort=data['tunPort']
|
||||
)
|
||||
|
||||
def macOsXScript(self, data):
|
||||
r = RDPFile(data['fullScreen'], data['width'], data['height'], data['depth'], target=OsDetector.Macintosh)
|
||||
r.address = '{address}'
|
||||
r.username = data['username']
|
||||
r.domain = data['domain']
|
||||
r.redirectPrinters = self.allowPrinters.isTrue()
|
||||
r.redirectSmartcards = self.allowSmartcards.isTrue()
|
||||
r.redirectDrives = self.allowDrives.isTrue()
|
||||
r.redirectSerials = self.allowSerials.isTrue()
|
||||
r.showWallpaper = self.wallpaper.isTrue()
|
||||
r.multimon = self.multimon.isTrue()
|
||||
|
||||
if data['domain'] != '':
|
||||
username = '{}\\\\{}'.format(data['domain'], data['username'])
|
||||
else:
|
||||
username = data['username']
|
||||
|
||||
return self.getScript('scripts/macosx/tunnel.py').format(
|
||||
os=data['os'],
|
||||
file=r.get(),
|
||||
password=data['password'],
|
||||
username=username,
|
||||
server=data['ip'],
|
||||
this_server=data['this_server'],
|
||||
r=r,
|
||||
port=3389,
|
||||
tunUser=data['tunUser'],
|
||||
tunPass=data['tunPass'],
|
||||
tunHost=data['tunHost'],
|
||||
tunPort=data['tunPort']
|
||||
)
|
||||
|
||||
def getUDSTransportScript(self, userService, transport, ip, os, user, password, request):
|
||||
# We use helper to keep this clean
|
||||
prefs = user.prefs('rdp')
|
||||
@ -146,10 +178,13 @@ class TSRDPTransport(BaseRDPTransport):
|
||||
'compression': True,
|
||||
'wallpaper': self.wallpaper.isTrue(),
|
||||
'multimon': self.multimon.isTrue(),
|
||||
'fullScreen': width == -1 or height == -1
|
||||
'fullScreen': width == -1 or height == -1,
|
||||
'this_server': request.build_absolute_uri('/')
|
||||
}
|
||||
|
||||
if data['os'] == OsDetector.Windows:
|
||||
return self.windowsScript(data)
|
||||
elif data['os'] == OsDetector.Macintosh:
|
||||
return self.macOsXScript(data)
|
||||
|
||||
return ''
|
||||
|
@ -2,7 +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
|
||||
# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
import win32crypt # @UnresolvedImport
|
||||
@ -16,16 +16,20 @@ import six
|
||||
|
||||
forwardThread, port = forward('{tunHost}', '{tunPort}', '{tunUser}', '{tunPass}', '{server}', '{port}')
|
||||
|
||||
theFile = '''{file}'''.format(
|
||||
password=win32crypt.CryptProtectData(six.binary_type('{password}'.encode('UTF-16LE')), None, None, None, None, 0x01).encode('hex'),
|
||||
address='127.0.0.1:{{}}'.format(port)
|
||||
)
|
||||
if forwardThread.status == 2:
|
||||
QtGui.QMessageBox.critical(parent, 'Error', 'Unable to open tunnel', QtGui.QMessageBox.Ok) # @UndefinedVariable
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
executable = os.path.join(os.path.join(os.environ['WINDIR'], 'system32'), 'mstsc.exe')
|
||||
else:
|
||||
|
||||
theFile = '''{file}'''.format(
|
||||
password=win32crypt.CryptProtectData(six.binary_type('{password}'.encode('UTF-16LE')), None, None, None, None, 0x01).encode('hex'),
|
||||
address='127.0.0.1:{{}}'.format(port)
|
||||
)
|
||||
|
||||
subprocess.call([executable, filename])
|
||||
tools.addFileToUnlink(filename)
|
||||
filename = tools.saveTempFile(theFile)
|
||||
executable = os.path.join(os.path.join(os.environ['WINDIR'], 'system32'), 'mstsc.exe')
|
||||
|
||||
subprocess.call([executable, filename])
|
||||
tools.addFileToUnlink(filename)
|
||||
|
||||
# QtGui.QMessageBox.critical(parent, 'Notice', filename + ", " + executable, QtGui.QMessageBox.Ok)
|
||||
|