1 # -*- coding: utf-8 -*-
3 # ------------------------------------------------------------
4 # directly start the browsing
6 # Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
8 # Copyright (C) 2013 AIT Austrian Institute of Technology
9 # AIT Austrian Institute of Technology GmbH
10 # Donau-City-Strasse 1 | 1220 Vienna | Austria
11 # http://www.ait.ac.at
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation version 2.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 # Boston, MA 02110-1301, USA.
26 # ------------------------------------------------------------
29 # ------------------------------------------------------------
36 from PyQt4 import QtCore
37 from PyQt4 import QtGui
40 import __init__ as opensecurity
43 if sys.platform == 'win32' or sys.platform == 'cygwin':
44 from cygwin import Cygwin
47 # ------------------------------------------------------------
52 if __name__ == "__main__":
54 if not (sys.platform == 'win32' or sys.platform == 'cygwin'):
55 QtGui.QMessageBox.critical(None, 'OpenSecurity Error', 'This action is not supported on this platform.\nSorry.')
60 # get a proper browsing VM
63 proxy_support = urllib2.ProxyHandler({})
64 opener = urllib2.build_opener(proxy_support)
65 urllib2.install_opener(opener)
68 proxy = proxy_getter.getProxySettings()
70 req_data = '?' + urllib.urlencode(proxy)
71 req = 'http://127.0.0.1:8080/browsing'+ req_data
72 browsing_vm = urllib2.urlopen(req).readline()
73 print('Called '+ req + ' got: ' + str(browsing_vm))
77 QtGui.QApplication.instance().processEvents()
78 QtGui.QMessageBox.critical(None, 'Failed to invoke Safe Internet Browsing', 'OpenSecurity Error')