Пример #1
0
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(
                    [
                        'security',
                        'add-generic-password',
                        '-w', sp['password'],  # @UndefinedVariable
                        '-U',
                        '-a', sp['usernameWithDomain'],  # @UndefinedVariable
                        '-s', 'Remote Desktop Connection 2 Password for 127.0.0.1'.format(port),
                        '-T', '/Applications/Remote Desktop Connection.app',
                    ]
                )
                tools.addExecBeforeExit(onExit)
            # Call but do not wait for exit
            tools.addTaskToWait(subprocess.Popen([executable, filename]))

            tools.addFileToUnlink(filename)
        except Exception as e:
            raise
    else:  # CoRD
        url = sp['as_cord_url'].format(address=address)  # @UndefinedVariable

        tools.addTaskToWait(subprocess.Popen(['open', url]))
Пример #2
0
    try:
        if {m.hasCredentials}:  # @UndefinedVariable
            subprocess.call([
                'security',
                'add-generic-password',
                '-w',
                '{m.password}',
                '-U',
                '-a',
                '{m.usernameWithDomain}',
                '-s',
                'Remote Desktop Connection 2 Password for {m.ip}',
                '-T',
                '/Applications/Remote Desktop Connection.app',
            ])
            tools.addExecBeforeExit(onExit)
        # Call but do not wait for exit
        tools.addTaskToWait(subprocess.Popen([executable, filename]))

        tools.addFileToUnlink(filename)
    except Exception as e:
        QtGui.QMessageBox.critical(parent, 'Notice', six.text_type(e),
                                   QtGui.QMessageBox.Ok)  # @UndefinedVariable
else:  # CoRD
    url = 'rdp://'

    username, domain = '{m.username}', '{m.domain}'

    if username != '':
        url += username
        if '{m.password}' != '':