Removed notes & added basic macosx info

This commit is contained in:
Adolfo Gómez 2015-04-06 23:18:41 -07:00
parent f8b95382b0
commit dc1dd977fc
27 changed files with 3 additions and 3670 deletions

View File

@ -1,2 +0,0 @@
/usr/share/applications/udsclient.desktop
exec update-desktop-database to update mime info on gnome

View File

@ -1,5 +0,0 @@
#!/usr/bin/env python
import sys
print sys.argv

View File

@ -1,12 +0,0 @@
[Desktop Entry]
Name=UDSClient
Comment=UDS Helper
Keywords=uds;client;vdi;
OnlyShowIn=GNOME;Unity;
Exec=/home/dkmaster/projects/uds/openuds/client/linux/test.py %u
Icon=help-browser
StartupNotify=true
Terminal=false
Type=Application
Categories=GNOME;GTK;Core;Documentation;Utility;
MimeType=x-scheme-handler/uds;x-scheme-handler/udss;

View File

@ -1,3 +0,0 @@
build
dist
udsclient.dmg

View File

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>UDSClient</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
<string>fold</string>
<string>disk</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>udsclient</string>
<key>CFBundleIconFile</key>
<string>PythonApplet.icns</string>
<key>CFBundleIdentifier</key>
<string>org.openuds.UDSClient</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>UDSClient</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>UDS Client</string>
<key>CFBundleURLSchemes</key>
<array>
<string>uds</string>
<string>udss</string>
</array>
</dict>
</array>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright not specified</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>PyMainFileNames</key>
<array>
<string>__boot__</string>
</array>
<key>PyOptions</key>
<dict>
<key>alias</key>
<true/>
<key>argv_emulation</key>
<true/>
<key>emulate_shell_environment</key>
<false/>
<key>no_chdir</key>
<false/>
<key>prefer_ppc</key>
<false/>
<key>site_packages</key>
<false/>
<key>use_faulthandler</key>
<false/>
<key>use_pythonpath</key>
<false/>
<key>verbose</key>
<false/>
</dict>
<key>PyResourcePackages</key>
<array>
</array>
<key>PyRuntimeLocations</key>
<array>
<string>@executable_path/../Frameworks/Python.framework/Versions/2.7/Python</string>
<string>/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/Python</string>
</array>
<key>PythonInfoDict</key>
<dict>
<key>PythonExecutable</key>
<string>/usr/local/opt/python/bin/python2.7</string>
<key>PythonLongVersion</key>
<string>2.7.9 (default, Feb 10 2015, 03:29:19)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)]</string>
<key>PythonShortVersion</key>
<string>2.7</string>
<key>py2app</key>
<dict>
<key>alias</key>
<true/>
<key>template</key>
<string>app</string>
<key>version</key>
<string>0.9</string>
</dict>
</dict>
</dict>
</plist>

View File

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="images">
<file alias="logo-uds-small">images/logo-uds-small.png</file>
<file alias="logo-uds-big">images/logo-uds.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -1,105 +0,0 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UDSWindow.ui'
#
# Created: Mon Mar 30 08:55:29 2015
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.setWindowModality(QtCore.Qt.NonModal)
MainWindow.resize(259, 185)
MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/logo-uds-small")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
MainWindow.setWindowOpacity(1.0)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setAutoFillBackground(True)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout_2.setSpacing(4)
self.verticalLayout_2.setMargin(4)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.frame = QtGui.QFrame(self.centralwidget)
self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
self.frame.setFrameShadow(QtGui.QFrame.Raised)
self.frame.setObjectName(_fromUtf8("frame"))
self.verticalLayout_3 = QtGui.QVBoxLayout(self.frame)
self.verticalLayout_3.setSpacing(4)
self.verticalLayout_3.setMargin(4)
self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.image = QtGui.QLabel(self.frame)
self.image.setMinimumSize(QtCore.QSize(0, 24))
self.image.setAutoFillBackground(True)
self.image.setText(_fromUtf8(""))
self.image.setPixmap(QtGui.QPixmap(_fromUtf8(":/images/logo-uds-small")))
self.image.setScaledContents(False)
self.image.setAlignment(QtCore.Qt.AlignCenter)
self.image.setObjectName(_fromUtf8("image"))
self.verticalLayout.addWidget(self.image)
self.info = QtGui.QLabel(self.frame)
self.info.setMaximumSize(QtCore.QSize(16777215, 16))
self.info.setObjectName(_fromUtf8("info"))
self.verticalLayout.addWidget(self.info)
self.progressBar = QtGui.QProgressBar(self.frame)
self.progressBar.setProperty("value", 24)
self.progressBar.setTextVisible(False)
self.progressBar.setObjectName(_fromUtf8("progressBar"))
self.verticalLayout.addWidget(self.progressBar)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.cancelButton = QtGui.QPushButton(self.frame)
self.cancelButton.setDefault(True)
self.cancelButton.setFlat(False)
self.cancelButton.setObjectName(_fromUtf8("cancelButton"))
self.horizontalLayout.addWidget(self.cancelButton)
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_3.addLayout(self.verticalLayout)
self.verticalLayout_2.addWidget(self.frame)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "UDS Connection", None))
self.info.setText(_translate("MainWindow", "TextLabel", None))
self.cancelButton.setText(_translate("MainWindow", "Cancel", None))
import UDSResources_rc
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

View File

@ -1,160 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>259</width>
<height>185</height>
</rect>
</property>
<property name="cursor">
<cursorShape>BusyCursor</cursorShape>
</property>
<property name="windowTitle">
<string>UDS Connection</string>
</property>
<property name="windowIcon">
<iconset resource="UDSResources.qrc">
<normaloff>:/images/logo-uds-small</normaloff>:/images/logo-uds-small</iconset>
</property>
<property name="windowOpacity">
<double>1.000000000000000</double>
</property>
<widget class="QWidget" name="centralwidget">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>4</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>4</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="image">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="UDSResources.qrc">:/images/logo-uds-small</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="info">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="UDSResources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1 +0,0 @@
security add-generic-password -w temporal -U -a 172.27.0.208\test -s Remote Desktop Connection 2 Password for 172.27.0.208

View File

@ -1,5 +0,0 @@
#!/bin/sh
python setup.py py2app --optimize 2 --plist Info.plist
rm UDSClient.dmg
hdiutil create -srcfolder dist/UDSClient.app UDSClient.dmg

View File

@ -1 +0,0 @@
/Applications/Remote Desktop Connection.app/Contents/MacOS/Remote Desktop Connection /tmp/kk.rdp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View File

@ -1,22 +0,0 @@
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['UDSClient.py']
DATA_FILES = []
OPTIONS = {
'argv_emulation': True,
'plist': 'Info.plist',
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)

View File

@ -1,6 +0,0 @@
<html>
<head></head>
<body>
<a href="uds://test">Test uds</a>
</body>
</html>

View File

@ -1,180 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AddToKeychain</key>
<true/>
<key>ApplicationPath</key>
<string></string>
<key>AudioRedirectionMode</key>
<integer>0</integer>
<key>AuthenticateLevel</key>
<integer>0</integer>
<key>AutoReconnect</key>
<true/>
<key>BitmapCaching</key>
<true/>
<key>ColorDepth</key>
<integer>1</integer>
<key>ConnectionString</key>
<string>172.27.0.208</string>
<key>DesktopSize</key>
<string>DesktopFullScreen</string>
<key>Display</key>
<integer>0</integer>
<key>Domain</key>
<string>172.27.0.208</string>
<key>DontWarnOnChange</key>
<true/>
<key>DontWarnOnDriveMount</key>
<true/>
<key>DontWarnOnQuit</key>
<true/>
<key>DriveRedirectionMode</key>
<integer>2</integer>
<key>FontSmoothing</key>
<true/>
<key>FullWindowDrag</key>
<false/>
<key>HideMacDock</key>
<true/>
<key>KeyMappingTable</key>
<dict>
<key>UI_ALPHANUMERIC_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>102</integer>
<key>MacModifier</key>
<integer>0</integer>
<key>On</key>
<true/>
</dict>
<key>UI_ALT_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>4294967295</integer>
<key>MacModifier</key>
<integer>2048</integer>
<key>On</key>
<true/>
</dict>
<key>UI_CONTEXT_MENU_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>120</integer>
<key>MacModifier</key>
<integer>2048</integer>
<key>On</key>
<true/>
</dict>
<key>UI_CONVERSION_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>4294967295</integer>
<key>MacModifier</key>
<integer>0</integer>
<key>On</key>
<false/>
</dict>
<key>UI_HALF_FULL_WIDTH_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>49</integer>
<key>MacModifier</key>
<integer>256</integer>
<key>On</key>
<true/>
</dict>
<key>UI_HIRAGANA_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>104</integer>
<key>MacModifier</key>
<integer>0</integer>
<key>On</key>
<true/>
</dict>
<key>UI_NON_CONVERSION_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>4294967295</integer>
<key>MacModifier</key>
<integer>0</integer>
<key>On</key>
<false/>
</dict>
<key>UI_NUM_LOCK_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>71</integer>
<key>MacModifier</key>
<integer>0</integer>
<key>On</key>
<true/>
</dict>
<key>UI_PAUSE_BREAK_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>99</integer>
<key>MacModifier</key>
<integer>2048</integer>
<key>On</key>
<true/>
</dict>
<key>UI_PRINT_SCREEN_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>118</integer>
<key>MacModifier</key>
<integer>2048</integer>
<key>On</key>
<true/>
</dict>
<key>UI_SCROLL_LOCK_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>107</integer>
<key>MacModifier</key>
<integer>0</integer>
<key>On</key>
<true/>
</dict>
<key>UI_SECONDARY_MOUSE_BUTTON</key>
<dict>
<key>MacKeyCode</key>
<integer>256</integer>
<key>MacModifier</key>
<integer>4608</integer>
<key>On</key>
<true/>
</dict>
<key>UI_WINDOWS_START_KEY</key>
<dict>
<key>MacKeyCode</key>
<integer>122</integer>
<key>MacModifier</key>
<integer>2048</integer>
<key>On</key>
<true/>
</dict>
</dict>
<key>MenuAnimations</key>
<false/>
<key>PrinterRedirection</key>
<true/>
<key>RedirectFolder</key>
<string>/Users/admin</string>
<key>RedirectPrinter</key>
<string></string>
<key>RemoteApplication</key>
<false/>
<key>Themes</key>
<true/>
<key>UserName</key>
<string>test</string>
<key>Wallpaper</key>
<true/>
<key>WorkingDirectory</key>
<string></string>
</dict>
</plist>

View File

@ -1,123 +0,0 @@
# Based on forward.py from paramiko
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
# https://github.com/paramiko/paramiko/blob/master/demos/forward.py
from __future__ import unicode_literals
import select
import SocketServer
import sys
import paramiko
import threading
g_verbose = True
class ForwardServer (SocketServer.ThreadingTCPServer):
daemon_threads = True
allow_reuse_address = True
class Handler (SocketServer.BaseRequestHandler):
def handle(self):
try:
chan = self.ssh_transport.open_channel('direct-tcpip',
(self.chain_host, self.chain_port),
self.request.getpeername())
except Exception as e:
verbose('Incoming request to %s:%d failed: %s' % (self.chain_host,
self.chain_port,
repr(e)))
return
if chan is None:
verbose('Incoming request to %s:%d was rejected by the SSH server.' %
(self.chain_host, self.chain_port))
return
verbose('Connected! Tunnel open %r -> %r -> %r' % (self.request.getpeername(),
chan.getpeername(), (self.chain_host, self.chain_port)))
while self.event.is_set() is False:
r, w, x = select.select([self.request, chan], [], [], 1)
if self.request in r:
data = self.request.recv(1024)
if len(data) == 0:
break
chan.send(data)
if chan in r:
data = chan.recv(1024)
if len(data) == 0:
break
self.request.send(data)
peername = self.request.getpeername()
chan.close()
self.request.close()
verbose('Tunnel closed from %r' % (peername,))
def verbose(s):
if g_verbose:
print(s)
class ForwardThread(threading.Thread):
def __init__(self, server, port, username, password, localPort, redirectHost, redirectPort):
threading.Thread.__init__(self)
self.client = None
self.fs = None
self.server = server
self.port = int(port)
self.username = username
self.password = password
self.localPort = int(localPort)
self.redirectHost = redirectHost
self.redirectPort = redirectPort
self.stopEvent = threading.Event()
def run(self):
self.client = paramiko.SSHClient()
self.client.load_system_host_keys()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
verbose('Connecting to ssh host %s:%d ...' % (self.server, self.port))
self.client.connect(self.server, self.port, username=self.username, password=self.password)
class SubHander (Handler):
chain_host = self.redirectHost
chain_port = self.redirectPort
ssh_transport = self.client.get_transport()
event = self.stopEvent
self.fs = ForwardServer(('', self.redirectPort), SubHander)
self.fs.serve_forever()
def stop(self):
try:
self.stopEvent.set()
self.fs.shutdown()
if self.client is not None:
self.client.close()
except Exception:
pass
def forward(server, port, username, password, localPort, redirectHost, redirectPort):
port, redirectPort = int(port), int(redirectPort)
verbose('Connected')
ft = ForwardThread(server, port, username, password, localPort, redirectHost, redirectPort)
ft.start()
return ft

View File

@ -1,49 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
import sys
LINUX = 'Linux'
WINDOWS = 'Windows'
MAC_OS_X = 'Mac os x'
def getOs():
if sys.platform.startswith('linux'):
return LINUX
elif sys.platform.startswith('win'):
return WINDOWS
elif sys.platform.startswith('darwin'):
return MAC_OS_X

View File

@ -1,108 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
from PyQt4.QtCore import pyqtSignal, pyqtSlot
from PyQt4.QtCore import QObject, QUrl, QSettings
from PyQt4.QtCore import Qt
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply, QSslCertificate
from PyQt4.QtGui import QMessageBox
import json
import osDetector
import six
class RestRequest(QObject):
restApiUrl = '' #
done = pyqtSignal(dict, name='done')
def __init__(self, url, parentWindow, done): # parent not used
super(RestRequest, self).__init__()
# private
self._manager = QNetworkAccessManager()
self.url = QUrl(RestRequest.restApiUrl + url)
# connect asynchronous result, when a request finishes
self._manager.finished.connect(self._finished)
self._manager.sslErrors.connect(self._sslError)
self._parentWindow = parentWindow
self.done.connect(done, Qt.QueuedConnection)
# private slot, no need to declare as slot
@pyqtSlot(QNetworkReply)
def _finished(self, reply):
'''
Handle signal 'finished'. A network request has finished.
'''
try:
if reply.error() != QNetworkReply.NoError:
raise Exception(reply.errorString())
data = json.loads(six.text_type(reply.readAll()))
except Exception as e:
data = {
'result': None,
'error': six.text_type(e)
}
self.done.emit(data)
reply.deleteLater() # schedule for delete from main event loop
@pyqtSlot(QNetworkReply, list)
def _sslError(self, reply, errors):
settings = QSettings()
cert = errors[0].certificate()
digest = six.text_type(cert.digest().toHex())
approved = settings.value(digest, False).toBool()
errorString = '<p>The certificate for <b>{}</b> has the following errors:</p><ul>'.format(cert.subjectInfo(QSslCertificate.CommonName))
for err in errors:
errorString += '<li>' + err.errorString() + '</li>'
errorString += '</ul>'
if approved or QMessageBox.warning(self._parentWindow, 'SSL Warning', errorString, QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
settings.setValue(digest, True)
reply.ignoreSslErrors()
def get(self):
request = QNetworkRequest(self.url)
request.setRawHeader('User-Agent', osDetector.getOs() + " - UDS Connector")
self._manager.get(request)

View File

@ -1,63 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
import tempfile
import string
import random
import os
_unlinkFiles = []
def saveTempFile(content, filename=None):
if filename is None:
filename = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16))
filename = filename + '.uds'
filename = os.path.join(tempfile.gettempdir(), filename)
with open(filename, 'w') as f:
f.write(content)
return filename
def addFileToUnlink(filename):
_unlinkFiles.append(filename)
def unlinkFiles():
for f in _unlinkFiles:
try:
os.unlink(f)
except Exception:
pass

View File

@ -1,198 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Virtual Cable S.L.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
import sys
from PyQt4 import QtCore, QtGui
import six
from uds.rest import RestRequest
from uds.forward import forward
from uds import tools
import webbrowser
import time
from UDSWindow import Ui_MainWindow
# Client connector version
VERSION = '1.9.5'
class UDSClient(QtGui.QMainWindow):
ticket = None
scrambler = None
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.progressBar.setValue(0)
self.ui.cancelButton.clicked.connect(self.cancelPushed)
self.ui.info.setText('Initializing...')
self.activateWindow()
def closeWindow(self):
self.close()
def processError(self, data):
if 'error' in data:
raise Exception(data['error'])
# QtGui.QMessageBox.critical(self, 'Request error', rest.data['error'], QtGui.QMessageBox.Ok)
# self.closeWindow()
# return
def showError(self, e):
self.ui.progressBar.setValue(100)
self.ui.info.setText('Error')
QtGui.QMessageBox.critical(self, 'Error', six.text_type(e), QtGui.QMessageBox.Ok)
self.closeWindow()
def cancelPushed(self):
self.close()
@QtCore.pyqtSlot()
def getVersion(self):
self.req = RestRequest('', self, self.version)
self.req.get()
@QtCore.pyqtSlot(dict)
def version(self, data):
try:
self.ui.progressBar.setValue(10)
self.processError(data)
self.ui.info.setText('Processing...')
if data['result']['requiredVersion'] > VERSION:
QtGui.QMessageBox.critical(self, 'Upgrade required', 'A newer connector version is required.\nA browser will be opened to download it.', QtGui.QMessageBox.Ok)
webbrowser.open(data['result']['downloadUrl'])
self.closeWindow()
return
self.req = RestRequest('/{}/{}'.format(self.ticket, self.scrambler), self, self.transportDataReceived)
self.req.get()
except Exception as e:
self.showError(e)
@QtCore.pyqtSlot(dict)
def transportDataReceived(self, data):
try:
self.ui.progressBar.setValue(20)
self.processError(data)
script = data['result']
print script
six.exec_(script, globals(), {'parent': self})
self.closeWindow()
except Exception as e:
self.showError(e)
def start(self):
'''
Starts proccess by requesting version info
'''
self.ui.info.setText('Initializing...')
QtCore.QTimer.singleShot(100, self.getVersion)
def done(data):
QtGui.QMessageBox.critical(None, 'Notice', six.text_type(data.data), QtGui.QMessageBox.Ok)
sys.exit(0)
if __name__ == "__main__":
# Initialize app
app = QtGui.QApplication(sys.argv)
# Set several info for settings
QtCore.QCoreApplication.setOrganizationName('Virtual Cable S.L.U.')
QtCore.QCoreApplication.setApplicationName('UDS Connector')
app.setStyle(QtGui.QStyleFactory.create('plastique'))
if six.PY3 is False:
import threading
threading._DummyThread._Thread__stop = lambda x: 42
# First parameter must be url
try:
uri = sys.argv[1]
if uri[:6] != 'uds://' and uri[:7] != 'udss://':
raise Exception()
ssl = uri[3] == 's'
host, UDSClient.ticket, UDSClient.scrambler = uri.split('//')[1].split('/')
except Exception:
QtGui.QMessageBox.critical(None, 'Notice', 'This program is designed to be used by UDS', QtGui.QMessageBox.Ok)
sys.exit(1)
# Setup REST api endpoint
# RestRequest.restApiUrl = '{}://{}/rest/client'.format(['http', 'https'][ssl], host)
RestRequest.restApiUrl = 'https://172.27.0.1/rest/client'
try:
win = UDSClient()
win.show()
win.start()
exitVal = app.exec_()
time.sleep(3)
tools.unlinkFiles()
sys.exit(exitVal)
except Exception as e:
QtGui.QMessageBox.critical(None, 'Error', six.text_type(e), QtGui.QMessageBox.Ok)
sys.stdin.read()
QtGui.QMessageBox.critical(None, 'Error', 'test', QtGui.QMessageBox.Ok)
# Build base REST
# v = RestRequest('', done)
# v.get()
# sys.exit(1)
# myapp = UDSConfigDialog(cfg)
# myapp.show()

View File

@ -1,15 +0,0 @@
#!/bin/bash
function process {
for a in *.ui; do
pyuic4 $a -o `basename $a .ui`.py -x
done
}
pyrcc4 -py3 UDSResources.qrc -o UDSResources_rc.py
# process current directory ui's
process

View File

@ -1,13 +0,0 @@
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\uds]
@="URL:Uds Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\uds\shell]
[HKEY_CLASSES_ROOT\uds\shell\open]
[HKEY_CLASSES_ROOT\uds\shell\open\command]
@="\"c:\\Python27\\python.exe\" \"C:\\Users\\dkmaster\\Documents\\Visual Studio 2013\\Projects\\PythonTest1\\PythonTest1\\PythonTest1.py\" \"%1\""

View File

@ -1,7 +0,0 @@
<html>
<head>
<title>Test</title>
<body>
<a href="uds://test">uds://test</a>
</body>
</html>

3
client/src/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/build
/dist
UDSClient.dmg