예제 #1
0
파일: tunnel.py 프로젝트: dkmstr/openuds
if executable is None:
    raise Exception('''<p>You need to have installed virt-viewer to connect to this UDS service.</p>
<p>
    Please, install appropriate package for your system.
</p>
<p>
    Please, install appropriate package for your Linux system. (probably named something like <b>virt-viewer</b>)
</p>
''')


theFile = '''{m.r.as_file_ns}'''
forwardThread1 = None
if {m.port} != -1:  # @UndefinedVariable
    forwardThread1, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', {m.port})  # @UndefinedVariable

    if forwardThread1.status == 2:
        raise Exception('Unable to open tunnel')
else:
    port = -1

if {m.secure_port} != -1:  # @UndefinedVariable
    theFile = '''{m.r.as_file}'''
    if port != -1:
        forwardThread2, secure_port = forwardThread1.clone('{m.ip}', {m.secure_port})  # @UndefinedVariable
    else:
        forwardThread2, secure_port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', {m.secure_port})  # @UndefinedVariable

    if forwardThread2.status == 2:
        raise Exception('Unable to open tunnel')
예제 #2
0
파일: tunnel.py 프로젝트: dkmstr/openuds
    )


if executable is None:
    raise Exception('''<p><b>Microsoft Remote Desktop Connection not found</b></p>
<p>In order to connect to UDS RDP Sessions, you need to have at least one of the following:<p>
<ul>
    <li>
        <p><b>CoRD</b> (A bit unstable from 10.7 onwards)</p>
        <p>You can get it from <a href="{}static/other/CoRD.pkg">this link</a></p>
    </li>
</ul>
<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, waitTime=sp['tunWait'])  # @UndefinedVariable
address = '127.0.0.1:{}'.format(port)

if forwardThread.status == 2:
    raise Exception('Unable to open tunnel')

else:
    if executable == msrdc:
        theFile = sp['as_file'].format(address=address)  # @UndefinedVariable
        filename = tools.saveTempFile(theFile)
        tools.addFileToUnlink(filename)
        
        try:
            if sp['password'] != '':  # @UndefinedVariable
                subprocess.call(
                    [
예제 #3
0
        '''<p>You need to have installed virt-viewer to connect to this UDS service.</p>
<p>
    Please, install appropriate package for your system.
</p>
<p>
    <a href="http://people.freedesktop.org/~teuf/spice-gtk-osx/dmg/0.5.7/RemoteViewer-0.5.7-1.dmg">Open download page</a>
</p>
<p>
    Please, note that in order to UDS Connector to work correctly, you must copy the Remote Viewer app to your Applications Folder.<br/>
    Also remember, that in order to allow this app to run on your system, you must open it one time once it is copied to your App folder
</p>
''')

theFile = sp['as_file_ns']
if sp['port'] != '-1':
    forwardThread1, port = forward(sp['tunHost'], sp['tunPort'], sp['tunUser'],
                                   sp['tunPass'], sp['ip'], sp['port'])

    if forwardThread1.status == 2:
        raise Exception('Unable to open tunnel')
else:
    port = -1

if sp['secure_port'] != '-1':
    theFile = sp['as_file']
    if port != -1:
        forwardThread2, secure_port = forwardThread1.clone(
            sp['ip'], sp['secure_port'])
    else:
        forwardThread2, secure_port = forward(sp['tunHost'], sp['tunPort'],
                                              sp['tunUser'], sp['tunPass'],
                                              sp['ip'], sp['secure_port'])
예제 #4
0
            re.search(r'version ([0-9]*\.[0-9]*)', version).groups()[0])
        if version < 1.1:
            raise Exception()
        else:
            fnc, app = execNewXFreeRdp, xfreerdp

    except Exception as e:  # Valid version not found, pass to check rdesktop
        # QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e), QtGui.QMessageBox.Ok)  # @UndefinedVariable
        pass

if app is None or fnc is None:
    raise Exception(
        '''<p>You need to have installed xfreerdp (>= 1.1) or rdesktop, and have them in your PATH in order to connect to this UDS service.</p>
    <p>Please, install apropiate package for your system.</p>
    <p>Also note that xfreerdp prior to version 1.1 will not be taken into consideration.</p>
''')
else:
    # Open tunnel
    forwardThread, port = forward('{m.tunHost}',
                                  '{m.tunPort}',
                                  '{m.tunUser}',
                                  '{m.tunPass}',
                                  '{m.ip}',
                                  3389,
                                  waitTime={m.tunWait})  # @UndefinedVariable

    if forwardThread.status == 2:
        raise Exception('Unable to open tunnel')

    fnc(parent, app, port)  # @UndefinedVariable
예제 #5
0
import subprocess
from uds.forward import forward  # @UnresolvedImport

from uds import tools  # @UnresolvedImport

try:
    cmd = tools.findApp('nxclient', ['/usr/NX/bin/'])
    if cmd is None:
        raise Exception()
except Exception:
    raise Exception('''<p>You need to have installed NX Client version 3.5 in order to connect to this UDS service.</p>
<p>Please, install appropriate package for your system.</p>
''')

# Open tunnel
forwardThread, port = forward(sp['tunHost'], sp['tunPort'], sp['tunUser'], sp['tunPass'], sp['ip'], sp['port'])
if forwardThread.status == 2:
    raise Exception('Unable to open tunnel')


theFile = sp['as_file_for_format'].format(
    address='127.0.0.1',
    port=port
)

filename = tools.saveTempFile(theFile)

cmd = cmd.replace('%1', filename)
tools.addTaskToWait(subprocess.Popen([cmd, '--session', filename]))
tools.addFileToUnlink(filename)
예제 #6
0
            </ul>
            ''')
    else:
        raise Exception('''<p><b>xfreerdp not found</b></p>
            <p>In order to connect to UDS RDP Sessions, you need to have a<p>
            <ul>
                <li>
                    <p><b>Xfreerdp</b> from homebrew</p>
                </li>
            </ul>
            ''')

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:
    if executable == msrdc:
        theFile = theFile = sp['as_file'].format(
            address='127.0.0.1:{}'.format(port))

        filename = tools.saveTempFile(theFile)
        # Rename as .rdp, so open recognizes it
예제 #7
0
파일: tunnel.py 프로젝트: techkie/openuds
<p>
    Please, install appropriate package for your system.
</p>
<p>
    <a href="http://people.freedesktop.org/~teuf/spice-gtk-osx/dmg/0.5.7/RemoteViewer-0.5.7-1.dmg">Open download page</a>
</p>
<p>
    Please, note that in order to UDS Connector to work correctly, you must copy the Remote Viewer app to your Applications Folder.<br/>
    Also remember, that in order to allow this app to run on your system, you must open it one time once it is copied to your App folder
</p>
''')

theFile = '''{m.r.as_file_ns}'''
if {m.port} != -1:  # @UndefinedVariable
    forwardThread1, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}',
                                   '{m.tunPass}', '{m.ip}',
                                   {m.port})  # @UndefinedVariable

    if forwardThread1.status == 2:
        raise Exception('Unable to open tunnel')
else:
    forwardThread1 = None
    port = -1

if {m.secure_port} != -1:  # @UndefinedVariable
    theFile = '''{m.r.as_file}'''
    if port != -1:
        forwardThread2, secure_port = forwardThread1.clone(
            '{m.ip}', {m.secure_port})  # @UndefinedVariable
    else:
        forwardThread2, secure_port = forward(
예제 #8
0
# Saved as .py for easier editing
from __future__ import unicode_literals

# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable

from PyQt4 import QtCore, QtGui
import win32crypt  # @UnresolvedImport
import os
import subprocess
from uds.forward import forward  # @UnresolvedImport

from uds import tools  # @UnresolvedImport

import six

forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', 3389)

if forwardThread.status == 2:
    raise Exception('Unable to open tunnel')

# 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 = '''{m.r.as_file}'''.format(
    password=win32crypt.CryptProtectData(six.binary_type('{m.password}'.encode('UTF-16LE')), None, None, None, None, 0x01).encode('hex'),
    address='127.0.0.1:{{}}'.format(port)
)

filename = tools.saveTempFile(theFile)
executable = tools.findApp('mstsc.exe')
if executable is None:
    raise Exception('Unable to find mstsc.exe')
예제 #9
0
from __future__ import unicode_literals

# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index
import subprocess
from uds.forward import forward  # @UnresolvedImport
import os

from uds import tools  # @UnresolvedImport


cmd = '/Applications/OpenNX/OpenNX.app/Contents/MacOS/OpenNXapp'
if os.path.isfile(cmd) is False:
    raise Exception('''<p>You need to have installed Open NX Client in order to connect to this UDS service.</p>
<p>Please, install appropriate package for your system from <a href="http://www.opennx.net/">here</a>.</p>
''')

forwardThread, port = forward(sp['tunHost'], sp['tunPort'], sp['tunUser'], sp['tunPass'], sp['ip'], sp['port'])  # @UndefinedVariable
if forwardThread.status == 2:
    raise Exception('Unable to open tunnel')


theFile = sp['as_file_for_format'].format(  # @UndefinedVariable
    address='127.0.0.1',
    port=port
)

filename = tools.saveTempFile(theFile)

tools.addTaskToWait(subprocess.Popen([cmd, '--session={}'.format(filename), '--autologin', '--killerrors']))
tools.addFileToUnlink(filename)
예제 #10
0
    <li>
        <p><b>Microsoft Remote Desktop Connection version 2.</b> (Recommended)</p>
        <p>You can get it from <a href="http://www.microsoft.com/es-es/download/details.aspx?id=18140">this link</a></p>
        <p>Remember that you need to use the One from the Microsoft site (the link provided), not the one from the AppStore</p>
    </li>
    <li>
        <p><b>CoRD</b> (A bit unstable from 10.7 onwards)</p>
        <p>You can get it from <a href="{m.this_server}static/other/CoRD.pkg">this link</a></p>
    </li>
</ul>
<p>If both apps are installed, Remote Desktop Connection will be used as first option</p>

''',
        QtGui.QMessageBox.Ok)

forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}',
                              '{m.tunPass}', '{m.ip}', 3389)

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:
        try:
            if {m.hasCredentials}:  # @UndefinedVariable
                subprocess.call([
                    'security',
                    'add-generic-password',
예제 #11
0
파일: tunnel.py 프로젝트: glyptodon/openuds
# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index
import subprocess
from uds.forward import forward  # @UnresolvedImport
import os

from uds import tools  # @UnresolvedImport


cmd = '/Applications/OpenNX/OpenNX.app/Contents/MacOS/OpenNXapp'
if os.path.isfile(cmd) is False:
    raise Exception('''<p>You need to have installed Open NX Client in order to connect to this UDS service.</p>
<p>Please, install appropriate package for your system from <a href="http://www.opennx.net/">here</a>.</p>
''')

forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}', '{m.tunPass}', '{m.ip}', {m.port})  # @UndefinedVariable
if forwardThread.status == 2:
    raise Exception('Unable to open tunnel')


theFile = '''{r.as_file_for_format}'''.format(
    address='127.0.0.1',
    port=port
)

filename = tools.saveTempFile(theFile)

cmd = cmd.replace('%1', filename)
tools.addTaskToWait(subprocess.Popen([cmd, '--session={{}}'.format(filename), '--autologin', '--killerrors']))
tools.addFileToUnlink(filename)
예제 #12
0
from uds import tools  # @UnresolvedImport

import six

try:
    cmd = tools.findApp("nxclient", ["/usr/NX/bin/"])
    if cmd is None:
        raise Exception()
except Exception:
    raise Exception(
        """<p>You need to have installed NX Client version 3.5 in order to connect to this UDS service.</p>
<p>Please, install appropriate package for your system.</p>
"""
    )

forwardThread, port = forward(
    "{m.tunHost}", "{m.tunPort}", "{m.tunUser}", "{m.tunPass}", "{m.ip}", {m.port}
)  # @UndefinedVariable
if forwardThread.status == 2:
    raise Exception("Unable to open tunnel")


theFile = """{r.as_file_for_format}""".format(address="127.0.0.1", port=port)

filename = tools.saveTempFile(theFile)

cmd = cmd.replace("%1", filename)
tools.addTaskToWait(subprocess.Popen([cmd, "--session", filename]))
tools.addFileToUnlink(filename)
예제 #13
0
파일: tunnel.py 프로젝트: techkie/openuds
import subprocess
from uds.forward import forward  # @UnresolvedImport

from uds import tools  # @UnresolvedImport

import six

try:
    cmd = tools.findApp('nxclient', ['/usr/NX/bin/'])
    if cmd is None:
        raise Exception()
except Exception:
    raise Exception(
        '''<p>You need to have installed NX Client version 3.5 in order to connect to this UDS service.</p>
<p>Please, install appropriate package for your system.</p>
''')

forwardThread, port = forward('{m.tunHost}', '{m.tunPort}', '{m.tunUser}',
                              '{m.tunPass}', '{m.ip}',
                              {m.port})  # @UndefinedVariable
if forwardThread.status == 2:
    raise Exception('Unable to open tunnel')

theFile = '''{r.as_file_for_format}'''.format(address='127.0.0.1', port=port)

filename = tools.saveTempFile(theFile)

cmd = cmd.replace('%1', filename)
tools.addTaskToWait(subprocess.Popen([cmd, '--session', filename]))
tools.addFileToUnlink(filename)