merge
authorOliver Maurhart <oliver.maurhart@ait.ac.at>
Wed, 25 Jun 2014 20:40:12 +0200
changeset 201c007fc48f812
parent 200 74e42f671ec4
parent 199 26b9a95b0da1
child 202 009ae01fd575
merge
     1.1 --- a/OpenSecurity.iss	Wed Jun 25 20:39:42 2014 +0200
     1.2 +++ b/OpenSecurity.iss	Wed Jun 25 20:40:12 2014 +0200
     1.3 @@ -35,6 +35,7 @@
     1.4  Source: "OpenSecurity\python27\Lib\site-packages\pywin32_system32\pywintypes27.dll"; DestDir: "{sys}"; Flags: sharedfile;
     1.5  Source: "OpenSecurity\systemprofile\.VirtualBox\*"; DestDir: "{sys}\config\systemprofile\.VirtualBox"; Flags: recursesubdirs createallsubdirs;
     1.6  Source: "OpenSecurity\systemprofile\VirtualBox VMs\*"; DestDir: "{sys}\config\systemprofile\VirtualBox VMs"; Flags: recursesubdirs createallsubdirs;
     1.7 +Source: "OpenSecurity\Apache License, Version 2.0.txt"; DestDir: "{app}";
     1.8  
     1.9  [Dirs]
    1.10  Name: "{app}\cygwin64\var\log\xwin"; Permissions: everyone-modify
    1.11 @@ -49,6 +50,8 @@
    1.12  [Icons]
    1.13  ; Program Icons in start menu
    1.14  Name: "{group}\OpenSecurity Tray Icon"; Filename: "{app}\python27\pythonw.exe"; Parameters: """{app}\bin\opensecurity_tray.pyw"""; WorkingDir: "{userappdata}"; Comment: "The OpenSecurity Tray Icon"; IconFilename: "{app}\bin\ui\gfx\OpenSecurity.ico"
    1.15 +Name: "{group}\Secure Browsing"; Filename: "{app}\cygiwn64\bin\wget.exe"; Parameters: """http://localhost:8080/browsing"""; WorkingDir: "{userappdata}"; Comment: "OpenSecurity Secure Browsing"; IconFilename: "{app}\bin\ui\gfx\opensecurity_browsing_64.ico"
    1.16 +Name: "{commondesktop}\Secure Browsing"; Filename: "{app}\python27\pythonw.exe"; Parameters: """{app}\bin\start_browsing.pyw"""; WorkingDir: "{userappdata}"; Comment: "OpenSecurity Secure Browsing"; IconFilename: "{app}\bin\ui\gfx\opensecurity_browsing_64.ico"
    1.17  Name: "{group}\Uninstall OpenSecurity"; Filename: "{uninstallexe}"
    1.18  
    1.19  [Run]
     2.1 --- a/OpenSecurity/bin/opensecurity_tray.pyw	Wed Jun 25 20:39:42 2014 +0200
     2.2 +++ b/OpenSecurity/bin/opensecurity_tray.pyw	Wed Jun 25 20:40:12 2014 +0200
     2.3 @@ -117,7 +117,6 @@
     2.4              
     2.5          except:
     2.6              
     2.7 -            d.hide()
     2.8              QtGui.QApplication.instance().processEvents()
     2.9              QtGui.QMessageBox.critical(None, 'Failed to invoke Safe Internet Browsing', 'OpenSecurity Error')
    2.10              
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/OpenSecurity/bin/start_browsing.pyw	Wed Jun 25 20:40:12 2014 +0200
     3.3 @@ -0,0 +1,70 @@
     3.4 +# -*- coding: utf-8 -*-
     3.5 +
     3.6 +# ------------------------------------------------------------
     3.7 +# directly start the browsing
     3.8 +# 
     3.9 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    3.10 +#
    3.11 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    3.12 +# AIT Austrian Institute of Technology GmbH
    3.13 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    3.14 +# http://www.ait.ac.at
    3.15 +#
    3.16 +# This program is free software; you can redistribute it and/or
    3.17 +# modify it under the terms of the GNU General Public License
    3.18 +# as published by the Free Software Foundation version 2.
    3.19 +# 
    3.20 +# This program is distributed in the hope that it will be useful,
    3.21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.23 +# GNU General Public License for more details.
    3.24 +# 
    3.25 +# You should have received a copy of the GNU General Public License
    3.26 +# along with this program; if not, write to the Free Software
    3.27 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    3.28 +# Boston, MA  02110-1301, USA.
    3.29 +# ------------------------------------------------------------
    3.30 +
    3.31 +
    3.32 +# ------------------------------------------------------------
    3.33 +# imports
    3.34 +
    3.35 +import sys
    3.36 +import urllib
    3.37 +import urllib2
    3.38 +
    3.39 +from PyQt4 import QtCore
    3.40 +from PyQt4 import QtGui
    3.41 +
    3.42 +# local
    3.43 +import __init__ as opensecurity
    3.44 +
    3.45 +if sys.platform == 'win32' or sys.platform == 'cygwin':
    3.46 +    from cygwin import Cygwin
    3.47 +
    3.48 +
    3.49 +# ------------------------------------------------------------
    3.50 +# code
    3.51 +
    3.52 +
    3.53 +# start
    3.54 +if __name__ == "__main__":
    3.55 +
    3.56 +    if not (sys.platform == 'win32' or sys.platform == 'cygwin'):
    3.57 +        QtGui.QMessageBox.critical(self.parent(), 'OpenSecurity Error', 'This action is not supported on this platform.\nSorry.')
    3.58 +        sys.exit(1)
    3.59 +   
    3.60 +    try:
    3.61 +    
    3.62 +        # get a proper browsing VM
    3.63 +        Cygwin.start_X11()
    3.64 +
    3.65 +        # TODO: HARDCODED ADDRESS OF OPENSECURITYD
    3.66 +        browsing_vm = urllib2.urlopen('http://127.0.0.1:8080/browsing').readline()
    3.67 +        print('Called http://127.0.0.1:8080/browsing got: ' + str(browsing_vm))
    3.68 +        
    3.69 +    except:
    3.70 +        
    3.71 +        QtGui.QApplication.instance().processEvents()
    3.72 +        QtGui.QMessageBox.critical(None, 'Failed to invoke Safe Internet Browsing', 'OpenSecurity Error')
    3.73 +
     4.1 --- a/OpenSecurity/bin/ui/about_dialog.py	Wed Jun 25 20:39:42 2014 +0200
     4.2 +++ b/OpenSecurity/bin/ui/about_dialog.py	Wed Jun 25 20:40:12 2014 +0200
     4.3 @@ -108,13 +108,13 @@
     4.4  </div>
     4.5  
     4.6  <div class="footer" align="left">
     4.7 -Copyright 2013, 2014 The OpenSecurity Consortium<br/>
     4.8 +Copyright 2013, 2014 The OpenSecurity Consortium, <a href="http://www.opensecurity.at">http://www.opensecurity.at</a><br/>
     4.9  <br/>
    4.10  Licensed under the Apache License, Version 2.0 (the "License");<br/>
    4.11  you may not use this file except in compliance with the License.<br/>
    4.12  You may obtain a copy of the License at<br/>
    4.13  <br/>
    4.14 -http://www.apache.org/licenses/LICENSE-2.0<br/>
    4.15 +<a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br/>
    4.16  <br/>
    4.17  Unless required by applicable law or agreed to in writing, software<br/>
    4.18  distributed under the License is distributed on an "AS IS" BASIS,<br/>
     5.1 --- a/OpenSecurity/bin/ui/configure_dialog.py	Wed Jun 25 20:39:42 2014 +0200
     5.2 +++ b/OpenSecurity/bin/ui/configure_dialog.py	Wed Jun 25 20:40:12 2014 +0200
     5.3 @@ -59,6 +59,7 @@
     5.4  
     5.5  import json
     5.6  import os
     5.7 +import subprocess
     5.8  import sys
     5.9  import urllib2
    5.10  
    5.11 @@ -103,13 +104,14 @@
    5.12          self._file_watched_name = ''
    5.13          self._file_watched_size = 0
    5.14          self._file_watcher = QtCore.QTimer(self)
    5.15 -        self._service_log_path = ''
    5.16 +        self._service_log_file = ''
    5.17          self._service_log_size = 0
    5.18  
    5.19          # connectors
    5.20          self.ui.btnAbout.clicked.connect(self.clicked_about)
    5.21          self.ui.btnClose.clicked.connect(self.accept)
    5.22          self.ui.btnDownload.clicked.connect(self.clicked_download)
    5.23 +        self.ui.btnExplorer.clicked.connect(self.clicked_explorer)
    5.24          self.ui.btnImport.clicked.connect(self.clicked_import)
    5.25          self.ui.btnRefresh.clicked.connect(self.clicked_refresh)
    5.26          self._file_watcher.timeout.connect(self.update_progress)
    5.27 @@ -144,6 +146,13 @@
    5.28              pass
    5.29  
    5.30  
    5.31 +    def clicked_explorer(self):
    5.32 +
    5.33 +        """Explorer button has been clicked."""
    5.34 +        if sys.platform == 'win32' or sys.platform == 'cygwin':
    5.35 +            subprocess.Popen([os.path.join(os.environ['WINDIR'], 'explorer.exe'), self._service_log_path])
    5.36 +
    5.37 +
    5.38      def clicked_import(self):
    5.39  
    5.40          """Import button has been clicked."""
    5.41 @@ -181,7 +190,8 @@
    5.42              self.ui.edtStatus.setEnabled(True)
    5.43              self.ui.edtVersion.setText(j['os_server']['version'])
    5.44              self.ui.edtVersion.setEnabled(True)
    5.45 -            self._service_log_path = os.path.join(j['os_server']['current log folder'], 'OpenSecurity.log')
    5.46 +            self._service_log_path = j['os_server']['current log folder']
    5.47 +            self._service_log_file = os.path.join(self._service_log_path, 'OpenSecurity.log')
    5.48              self._service_log_size = 0
    5.49  
    5.50              # get initial template info
    5.51 @@ -216,10 +226,10 @@
    5.52          # This is terrible. 
    5.53  
    5.54          # first the service log
    5.55 -        if self._service_log_path != '':
    5.56 -            file_size = os.stat(self._service_log_path).st_size
    5.57 +        if self._service_log_file != '':
    5.58 +            file_size = os.stat(self._service_log_file).st_size
    5.59              if file_size > self._service_log_size:
    5.60 -                f = open(self._service_log_path, 'r')
    5.61 +                f = open(self._service_log_file, 'r')
    5.62                  f.seek(self._service_log_size)
    5.63                  self.ui.edtLog.appendPlainText(f.read())
    5.64                  self._service_log_size = file_size
    5.65 @@ -233,9 +243,8 @@
    5.66              return
    5.67  
    5.68          f = open(self._file_watched_name, 'r')
    5.69 -        f.seek(self._file_watched_size)
    5.70 -        self.ui.edtProgress.appendPlainText(f.read())
    5.71 -        #self.ui.edtProgress.verticalScrollBar().setValue(self.ui.edtProgress.verticalScrollBar().maximum())
    5.72 +        self.ui.edtProgress.setPlainText(f.read())
    5.73 +        self.ui.edtProgress.verticalScrollBar().setValue(self.ui.edtProgress.verticalScrollBar().maximum())
    5.74          self._file_watched_size = file_size
    5.75  
    5.76