# HG changeset patch # User om # Date 1386692652 -3600 # Node ID 6d7b4672414c3e5e253f3d6d9197863e993163a3 # Parent cc6abcf9108b2dd6b06a49ed5475fb34d9424660 added opensecurity-system tray starter diff -r cc6abcf9108b -r 6d7b4672414c OpenSecurity/bin/launch.py --- a/OpenSecurity/bin/launch.py Tue Dec 10 16:02:24 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -#!/bin/env python -# -*- coding: utf-8 -*- - -# ------------------------------------------------------------ -# opensecurity-launcher -# -# launches an application inside a VM -# -# Autor: Oliver Maurhart, -# -# Copyright (C) 2013 AIT Austrian Institute of Technology -# AIT Austrian Institute of Technology GmbH -# Donau-City-Strasse 1 | 1220 Vienna | Austria -# http://www.ait.ac.at -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation version 2. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# ------------------------------------------------------------ - - -# ------------------------------------------------------------ -# imports - -import argparse -import os -import subprocess -import sys -import urllib -import urllib2 - -from PyQt4 import QtCore -from PyQt4 import QtGui - -# local -from about import About -from cygwin import Cygwin -from environment import Environment - - -# ------------------------------------------------------------ -# code - - -class Chooser(QtGui.QDialog, object): - - """Ask the user what to launch.""" - - def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)): - - super(Chooser, self).__init__(parent, flags) - self.setWindowTitle('OpenSecuirty Launch Application') - self.setup_ui() - - # positionate ourself central - screen = QtGui.QDesktopWidget().screenGeometry() - self.resize(self.geometry().width() * 1.25, self.geometry().height()) - size = self.geometry() - self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) - - self._vms = [ { 'name': 'SecurityDVM0', 'ip': '192.168.56.101' } ] - self._apps = [ { 'name': 'Browser', 'command': '/usr/bin/iceweasel' } ] - - # add the VMs we know - self._cbVM.clear() - for vm in self._vms: - self._cbVM.addItem(vm['name']) - - # add the commands we know - self._cbApplication.clear() - for app in self._apps: - self._cbApplication.addItem(app['name']) - - - - def app_get(self): - """The application of the user.""" - a = str(self._cbApplication.currentText()) - for app in self._apps: - if a == app['name']: - return app['command'] - return a - - app = property(app_get) - - - def clicked_about(self): - """clicked the about button""" - dlgAbout = About() - dlgAbout.exec_() - - - def clicked_cancel(self): - """clicked the cancel button""" - self.reject() - - - def clicked_ok(self): - """clicked the ok button""" - self.accept() - - - def setup_ui(self): - """Create the widgets.""" - - lyMain = QtGui.QVBoxLayout(self) - lyMain.setContentsMargins(8, 8, 8, 8) - - # content area: left pixmap, right text - lyContent = QtGui.QHBoxLayout() - lyMain.addLayout(lyContent) - - # pixmap - lbPix = QtGui.QLabel() - lbPix.setPixmap(QtGui.QPixmapCache.find('opensecurity_icon_64')) - lyContent.addWidget(lbPix, 0, QtCore.Qt.Alignment(QtCore.Qt.AlignTop + QtCore.Qt.AlignHCenter)) - lyContent.addSpacing(16) - - # launch ... - lyLaunch = QtGui.QGridLayout() - lyContent.addLayout(lyLaunch) - lbTitle = QtGui.QLabel('Specify details for application to launch.') - lyLaunch.addWidget(lbTitle, 0, 0, 1, 2) - - lbVM = QtGui.QLabel('&VM-ID:') - lyLaunch.addWidget(lbVM, 1, 0) - self._cbVM = QtGui.QComboBox() - self._cbVM.setEditable(True) - self._cbVM.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically) - lyLaunch.addWidget(self._cbVM, 1, 1) - lbVM.setBuddy(self._cbVM) - - lbApplication = QtGui.QLabel('&Application:') - lyLaunch.addWidget(lbApplication, 2, 0) - self._cbApplication = QtGui.QComboBox() - self._cbApplication.setEditable(True) - self._cbApplication.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically) - lyLaunch.addWidget(self._cbApplication, 2, 1) - lbApplication.setBuddy(self._cbApplication) - - lyLaunch.addWidget(QtGui.QWidget(), 3, 0, 1, 2) - lyLaunch.setColumnStretch(1, 1) - lyLaunch.setRowStretch(3, 1) - - lyMain.addStretch(1) - - # buttons - lyButton = QtGui.QHBoxLayout() - lyMain.addLayout(lyButton) - - lyButton.addStretch(1) - btnOk = QtGui.QPushButton('&Ok', self) - btnOk.setDefault(True) - btnOk.setMinimumWidth(100) - lyButton.addWidget(btnOk) - btnCancel = QtGui.QPushButton('&Cancel', self) - btnCancel.setMinimumWidth(100) - lyButton.addWidget(btnCancel) - btnAbout = QtGui.QPushButton('&About', self) - btnAbout.setMinimumWidth(100) - lyButton.addWidget(btnAbout) - - button_width = max(btnOk.width(), btnCancel.width(), btnAbout.width()) - btnOk.setMinimumWidth(button_width) - btnCancel.setMinimumWidth(button_width) - btnAbout.setMinimumWidth(button_width) - - # reduce to the max - self.resize(lyMain.minimumSize()) - - # connectors - btnOk.clicked.connect(self.clicked_ok) - btnCancel.clicked.connect(self.clicked_cancel) - btnAbout.clicked.connect(self.clicked_about) - - - def vm_get(self): - """The vm of choice.""" - v = str(self._cbVM.currentText()) - for vm in self._vms: - if v == vm['name']: - return vm['ip'] - return v - - vm = property(vm_get) - - -def ask_user(): - """ask the user for VM and app to start""" - - # launch Qt - app = QtGui.QApplication(sys.argv) - - # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them - image_path = os.path.join(Environment("OpenSecurity").data_path, '..', 'gfx') - for file in os.listdir(image_path): - if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'): - QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(image_path, file))) - - # we should have now our application icon - app.setWindowIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64'))) - - # pop up the dialog - dlg = Chooser() - dlg.show() - app.exec_() - - if dlg.result() == QtGui.QDialog.Accepted: - return dlg.vm, dlg.app - - return '', '' - - -def main(): - """entry point""" - - # parse command line - parser = argparse.ArgumentParser(description = 'OpenSecurity Launcher: run application in VM') - parser.add_argument('ip', metavar='IP', help='IP of Virtual Machine', nargs='?', type=str, default='') - parser.add_argument('command', metavar='COMMAND', help='Full path of command and arguments to start inside VM', nargs='?', type=str, default='') - args = parser.parse_args() - - # we must have at least all or none set - set_ip = args.ip != '' - set_command = args.command != '' - set_ALL = set_ip and set_command - set_NONE = (not set_ip) and (not set_command) - if (not set_ALL) and (not set_NONE): - sys.stderr.write("Please specify ip and command or none.\n") - sys.stderr.write("Type '--help' for help.\n") - sys.exit(1) - - # check if we need to ask the user - if set_NONE: - args.ip, args.command = ask_user() - - # still no IP? --> no chance, over and out! - if args.ip == '': - sys.exit(0) - - # ensure we have our X11 running - #Cygwin.start_X11() - - # call the OpenSecurity Admin to launch our progie =) - url_vm = urllib.quote(args.ip) - url_command = urllib.quote(args.command) - print(url_vm) - print(url_command) - - # user_at_guest = args.user + '@' + args.ip - # ssh = 'DISPLAY=:0 /usr/bin/ssh -Y ' + user_at_guest + ' ' + args.command - # print(ssh) - - # # off we go! - # Cygwin()(['/bin/bash', '--login', '-i', '-c', ssh], None, None, None) - - -# start -if __name__ == "__main__": - main() - diff -r cc6abcf9108b -r 6d7b4672414c OpenSecurity/bin/launch.pyw --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/bin/launch.pyw Tue Dec 10 17:24:12 2013 +0100 @@ -0,0 +1,271 @@ +#!/bin/env python +# -*- coding: utf-8 -*- + +# ------------------------------------------------------------ +# opensecurity-launcher +# +# launches an application inside a VM +# +# Autor: Oliver Maurhart, +# +# Copyright (C) 2013 AIT Austrian Institute of Technology +# AIT Austrian Institute of Technology GmbH +# Donau-City-Strasse 1 | 1220 Vienna | Austria +# http://www.ait.ac.at +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# ------------------------------------------------------------ + + +# ------------------------------------------------------------ +# imports + +import argparse +import os +import subprocess +import sys +import urllib +import urllib2 + +from PyQt4 import QtCore +from PyQt4 import QtGui + +# local +from about import About +from cygwin import Cygwin +from environment import Environment + + +# ------------------------------------------------------------ +# code + + +class Chooser(QtGui.QDialog, object): + + """Ask the user what to launch.""" + + def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)): + + super(Chooser, self).__init__(parent, flags) + self.setWindowTitle('OpenSecuirty Launch Application') + self.setup_ui() + + # positionate ourself central + screen = QtGui.QDesktopWidget().screenGeometry() + self.resize(self.geometry().width() * 1.25, self.geometry().height()) + size = self.geometry() + self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) + + self._vms = [ { 'name': 'SecurityDVM0', 'ip': '192.168.56.101' } ] + self._apps = [ { 'name': 'Browser', 'command': '/usr/bin/iceweasel' } ] + + # add the VMs we know + self._cbVM.clear() + for vm in self._vms: + self._cbVM.addItem(vm['name']) + + # add the commands we know + self._cbApplication.clear() + for app in self._apps: + self._cbApplication.addItem(app['name']) + + + + def app_get(self): + """The application of the user.""" + a = str(self._cbApplication.currentText()) + for app in self._apps: + if a == app['name']: + return app['command'] + return a + + app = property(app_get) + + + def clicked_about(self): + """clicked the about button""" + dlgAbout = About() + dlgAbout.exec_() + + + def clicked_cancel(self): + """clicked the cancel button""" + self.reject() + + + def clicked_ok(self): + """clicked the ok button""" + self.accept() + + + def setup_ui(self): + """Create the widgets.""" + + lyMain = QtGui.QVBoxLayout(self) + lyMain.setContentsMargins(8, 8, 8, 8) + + # content area: left pixmap, right text + lyContent = QtGui.QHBoxLayout() + lyMain.addLayout(lyContent) + + # pixmap + lbPix = QtGui.QLabel() + lbPix.setPixmap(QtGui.QPixmapCache.find('opensecurity_icon_64')) + lyContent.addWidget(lbPix, 0, QtCore.Qt.Alignment(QtCore.Qt.AlignTop + QtCore.Qt.AlignHCenter)) + lyContent.addSpacing(16) + + # launch ... + lyLaunch = QtGui.QGridLayout() + lyContent.addLayout(lyLaunch) + lbTitle = QtGui.QLabel('Specify details for application to launch.') + lyLaunch.addWidget(lbTitle, 0, 0, 1, 2) + + lbVM = QtGui.QLabel('&VM-ID:') + lyLaunch.addWidget(lbVM, 1, 0) + self._cbVM = QtGui.QComboBox() + self._cbVM.setEditable(True) + self._cbVM.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically) + lyLaunch.addWidget(self._cbVM, 1, 1) + lbVM.setBuddy(self._cbVM) + + lbApplication = QtGui.QLabel('&Application:') + lyLaunch.addWidget(lbApplication, 2, 0) + self._cbApplication = QtGui.QComboBox() + self._cbApplication.setEditable(True) + self._cbApplication.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically) + lyLaunch.addWidget(self._cbApplication, 2, 1) + lbApplication.setBuddy(self._cbApplication) + + lyLaunch.addWidget(QtGui.QWidget(), 3, 0, 1, 2) + lyLaunch.setColumnStretch(1, 1) + lyLaunch.setRowStretch(3, 1) + + lyMain.addStretch(1) + + # buttons + lyButton = QtGui.QHBoxLayout() + lyMain.addLayout(lyButton) + + lyButton.addStretch(1) + btnOk = QtGui.QPushButton('&Ok', self) + btnOk.setDefault(True) + btnOk.setMinimumWidth(100) + lyButton.addWidget(btnOk) + btnCancel = QtGui.QPushButton('&Cancel', self) + btnCancel.setMinimumWidth(100) + lyButton.addWidget(btnCancel) + btnAbout = QtGui.QPushButton('&About', self) + btnAbout.setMinimumWidth(100) + lyButton.addWidget(btnAbout) + + button_width = max(btnOk.width(), btnCancel.width(), btnAbout.width()) + btnOk.setMinimumWidth(button_width) + btnCancel.setMinimumWidth(button_width) + btnAbout.setMinimumWidth(button_width) + + # reduce to the max + self.resize(lyMain.minimumSize()) + + # connectors + btnOk.clicked.connect(self.clicked_ok) + btnCancel.clicked.connect(self.clicked_cancel) + btnAbout.clicked.connect(self.clicked_about) + + + def vm_get(self): + """The vm of choice.""" + v = str(self._cbVM.currentText()) + for vm in self._vms: + if v == vm['name']: + return vm['ip'] + return v + + vm = property(vm_get) + + +def ask_user(): + """ask the user for VM and app to start""" + + # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them + image_path = os.path.join(Environment("OpenSecurity").data_path, '..', 'gfx') + for file in os.listdir(image_path): + if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'): + QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(image_path, file))) + + # we should have now our application icon + app.setWindowIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64'))) + + # pop up the dialog + dlg = Chooser() + dlg.show() + app.exec_() + + if dlg.result() == QtGui.QDialog.Accepted: + return dlg.vm, dlg.app + + return '', '' + + +def main(): + """entry point""" + + # launch Qt + global app + app = QtGui.QApplication(sys.argv) + + # parse command line + parser = argparse.ArgumentParser(description = 'OpenSecurity Launcher: run application in VM') + parser.add_argument('ip', metavar='IP', help='IP of Virtual Machine', nargs='?', type=str, default='') + parser.add_argument('command', metavar='COMMAND', help='Full path of command and arguments to start inside VM', nargs='?', type=str, default='') + args = parser.parse_args() + + # we must have at least all or none set + set_ip = args.ip != '' + set_command = args.command != '' + set_ALL = set_ip and set_command + set_NONE = (not set_ip) and (not set_command) + if (not set_ALL) and (not set_NONE): + sys.stderr.write("Please specify ip and command or none.\n") + sys.stderr.write("Type '--help' for help.\n") + sys.exit(1) + + # check if we need to ask the user + if set_NONE: + args.ip, args.command = ask_user() + + # still no IP? --> no chance, over and out! + if args.ip == '': + sys.exit(0) + + # ensure we have our X11 running + Cygwin.start_X11() + + # call the OpenSecurity Admin to launch our progie =) + url_vm = urllib.quote(args.ip) + url_command = urllib.quote(args.command) + QtGui.QMessageBox.information(None, 'OpenSecurity Launche', 'About to launch
' + url_command + '
at VM
' + url_vm + '') + + # user_at_guest = args.user + '@' + args.ip + # ssh = 'DISPLAY=:0 /usr/bin/ssh -Y ' + user_at_guest + ' ' + args.command + # print(ssh) + + # # off we go! + # Cygwin()(['/bin/bash', '--login', '-i', '-c', ssh], None, None, None) + + +# start +if __name__ == "__main__": + main() + diff -r cc6abcf9108b -r 6d7b4672414c OpenSecurity/bin/opensecurity_tray.py --- a/OpenSecurity/bin/opensecurity_tray.py Tue Dec 10 16:02:24 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -#!/bin/env python -# -*- coding: utf-8 -*- - -# ------------------------------------------------------------ -# opensecurity-dialog -# -# an opensecurity dialog -# -# Autor: Oliver Maurhart, -# -# Copyright (C) 2013 AIT Austrian Institute of Technology -# AIT Austrian Institute of Technology GmbH -# Donau-City-Strasse 1 | 1220 Vienna | Austria -# http://www.ait.ac.at -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation version 2. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# ------------------------------------------------------------ - - -# ------------------------------------------------------------ -# imports - -import argparse -import os -import subprocess -import sys - -from PyQt4 import QtCore -from PyQt4 import QtGui - -# local -from about import About -from environment import Environment - - -# ------------------------------------------------------------ -# code - - -class OpenSecurityTrayIcon(QtGui.QSystemTrayIcon): - - """This is the OpenSecuirty Tray Icon""" - - def __init__(self, icon, parent=None): - - super(OpenSecurityTrayIcon, self).__init__(icon, parent) - self.setup_ui() - - - def clicked_about(self): - """clicked about""" - dlgAbout = About() - dlgAbout.exec_() - - - def clicked_exit(self): - """clicked exit""" - sys.exit(0) - - - def clicked_launch_application(self): - """clicked the launch an application""" - dlg_launch_image = os.path.join(sys.path[0], 'launch.pyw') - process_command = [sys.executable, dlg_launch_image] - print(process_command) - process = subprocess.Popen(process_command, shell = False) - process.communicate() - - - def clicked_refresh(self): - """clicked refresh""" - self.setup_ui() - - - def setup_ui(self): - """create the user interface - As for the system tray this is 'just' the context menu. - """ - - # define the tray icon menu - menu = QtGui.QMenu(self.parent()) - self.setContextMenu(menu) - - # add known apps - - # add standard menu items - cAcLaunch = menu.addAction(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), 'Lauch Application') - menu.addSeparator() - cAcRefresh = menu.addAction('Refresh') - cAcAbout = menu.addAction("About") - cAcExit = menu.addAction("Exit") - - cAcLaunch.triggered.connect(self.clicked_launch_application) - cAcRefresh.triggered.connect(self.clicked_refresh) - cAcAbout.triggered.connect(self.clicked_about) - cAcExit.triggered.connect(self.clicked_exit) - - -def main(): - - app = QtGui.QApplication(sys.argv) - - # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them - image_path = os.path.join(Environment("OpenSecurity").data_path, '..', 'gfx') - for file in os.listdir(image_path): - if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'): - QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(image_path, file))) - - w = QtGui.QWidget() - trayIcon = OpenSecurityTrayIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), w) - - trayIcon.show() - sys.exit(app.exec_()) - - -# start -if __name__ == "__main__": - main() - diff -r cc6abcf9108b -r 6d7b4672414c OpenSecurity/bin/opensecurity_tray.pyw --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/bin/opensecurity_tray.pyw Tue Dec 10 17:24:12 2013 +0100 @@ -0,0 +1,143 @@ +#!/bin/env python +# -*- coding: utf-8 -*- + +# ------------------------------------------------------------ +# opensecurity-dialog +# +# an opensecurity dialog +# +# Autor: Oliver Maurhart, +# +# Copyright (C) 2013 AIT Austrian Institute of Technology +# AIT Austrian Institute of Technology GmbH +# Donau-City-Strasse 1 | 1220 Vienna | Austria +# http://www.ait.ac.at +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# ------------------------------------------------------------ + + +# ------------------------------------------------------------ +# imports + +import argparse +import os +import subprocess +import sys + +from PyQt4 import QtCore +from PyQt4 import QtGui + +# local +from about import About +from environment import Environment + + +# ------------------------------------------------------------ +# code + + +class OpenSecurityTrayIcon(QtGui.QSystemTrayIcon): + + """This is the OpenSecuirty Tray Icon""" + + def __init__(self, icon, parent=None): + + super(OpenSecurityTrayIcon, self).__init__(icon, parent) + self.setup_ui() + + + def clicked_about(self): + """clicked about""" + dlgAbout = About() + dlgAbout.exec_() + + + def clicked_browser(self): + """wish for safe internet browsing""" + dlg_launch_image = os.path.join(sys.path[0], 'launch.pyw') + process_command = [sys.executable, dlg_launch_image, '192.168.56.101', '/usr/bin/iceweasel'] + print(process_command) + process = subprocess.Popen(process_command, shell = False) + process.communicate() + + + def clicked_exit(self): + """clicked exit""" + sys.exit(0) + + + def clicked_launch_application(self): + """clicked the launch an application""" + dlg_launch_image = os.path.join(sys.path[0], 'launch.pyw') + process_command = [sys.executable, dlg_launch_image] + print(process_command) + process = subprocess.Popen(process_command, shell = False) + process.communicate() + + + def clicked_refresh(self): + """clicked refresh""" + self.setup_ui() + + + def setup_ui(self): + """create the user interface + As for the system tray this is 'just' the context menu. + """ + + # define the tray icon menu + menu = QtGui.QMenu(self.parent()) + self.setContextMenu(menu) + + # add known apps + cAcBrowser = menu.addAction(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), 'Safe Internet Browsing') + menu.addSeparator() + + # add standard menu items + cAcLaunch = menu.addAction(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), 'Lauch Application') + menu.addSeparator() + cAcRefresh = menu.addAction('Refresh') + cAcAbout = menu.addAction("About") + cAcExit = menu.addAction("Exit") + + cAcBrowser.triggered.connect(self.clicked_browser) + cAcLaunch.triggered.connect(self.clicked_launch_application) + cAcRefresh.triggered.connect(self.clicked_refresh) + cAcAbout.triggered.connect(self.clicked_about) + cAcExit.triggered.connect(self.clicked_exit) + + +def main(): + + app = QtGui.QApplication(sys.argv) + + # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them + image_path = os.path.join(Environment("OpenSecurity").data_path, '..', 'gfx') + for file in os.listdir(image_path): + if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'): + QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(image_path, file))) + + w = QtGui.QWidget() + trayIcon = OpenSecurityTrayIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), w) + + trayIcon.show() + sys.exit(app.exec_()) + + +# start +if __name__ == "__main__": + main() + diff -r cc6abcf9108b -r 6d7b4672414c OpenSecurity/bin/os-tray.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/bin/os-tray.bat Tue Dec 10 17:24:12 2013 +0100 @@ -0,0 +1,3 @@ +@echo off +cd %0%\.. +START /B CMD /C "C:\Python27\pythonw opensecurity_tray.pyw" >NUL 2>&1 \ No newline at end of file diff -r cc6abcf9108b -r 6d7b4672414c OpenSecurity/cygwin/content.txt --- a/OpenSecurity/cygwin/content.txt Tue Dec 10 16:02:24 2013 +0100 +++ b/OpenSecurity/cygwin/content.txt Tue Dec 10 17:24:12 2013 +0100 @@ -8,3 +8,4 @@ - openssh - xinit - genisofs + - xset