# HG changeset patch # User Bartha Mihai # Date 1414506042 -3600 # Node ID d33edf5c27178abb558c9a84855fed06d591ffae # Parent 63f6861d0ad9e99c418234600ab7e646567a95ab modified start_browsing script to use the proxy settings diff -r 63f6861d0ad9 -r d33edf5c2717 OpenSecurity/bin/opensecurity_tray.pyw --- a/OpenSecurity/bin/opensecurity_tray.pyw Wed Oct 22 18:36:04 2014 +0200 +++ b/OpenSecurity/bin/opensecurity_tray.pyw Tue Oct 28 15:20:42 2014 +0100 @@ -143,7 +143,7 @@ def clicked_exit(self): """clicked exit""" - opensecurity_client_restful_server.stop() + #opensecurity_client_restful_server.stop() sys.exit(0) diff -r 63f6861d0ad9 -r d33edf5c2717 OpenSecurity/bin/start_browsing.pyw --- a/OpenSecurity/bin/start_browsing.pyw Wed Oct 22 18:36:04 2014 +0200 +++ b/OpenSecurity/bin/start_browsing.pyw Tue Oct 28 15:20:42 2014 +0100 @@ -38,6 +38,7 @@ # local import __init__ as opensecurity +import proxy_getter if sys.platform == 'win32' or sys.platform == 'cygwin': from cygwin import Cygwin @@ -51,17 +52,25 @@ if __name__ == "__main__": if not (sys.platform == 'win32' or sys.platform == 'cygwin'): - QtGui.QMessageBox.critical(self.parent(), 'OpenSecurity Error', 'This action is not supported on this platform.\nSorry.') + QtGui.QMessageBox.critical(None, 'OpenSecurity Error', 'This action is not supported on this platform.\nSorry.') sys.exit(1) try: # get a proper browsing VM Cygwin.start_X11() + + proxy_support = urllib2.ProxyHandler({}) + opener = urllib2.build_opener(proxy_support) + urllib2.install_opener(opener) - # TODO: HARDCODED ADDRESS OF OPENSECURITYD - browsing_vm = urllib2.urlopen('http://127.0.0.1:8080/browsing').readline() - print('Called http://127.0.0.1:8080/browsing got: ' + str(browsing_vm)) + req_data = "" + proxy = proxy_getter.getProxySettings() + if proxy: + req_data = '?' + urllib.urlencode(proxy) + req = 'http://127.0.0.1:8080/browsing'+ req_data + browsing_vm = urllib2.urlopen(req).readline() + print('Called '+ req + ' got: ' + str(browsing_vm)) except: diff -r 63f6861d0ad9 -r d33edf5c2717 OpenSecurity/bin/vmmanager.pyw --- a/OpenSecurity/bin/vmmanager.pyw Wed Oct 22 18:36:04 2014 +0200 +++ b/OpenSecurity/bin/vmmanager.pyw Tue Oct 28 15:20:42 2014 +0100 @@ -1051,8 +1051,6 @@ def run(self): session = None try: - #appDataDir = self.getAppDataDir() - session = self.vmm.getSession() if not session: raise OpenSecurityException("Could not get new SDVM session.") @@ -1063,16 +1061,6 @@ self.net_resource = '\\\\' + self.ip_addr + '\\Download' urllib2.urlopen('http://127.0.0.1:8090/netmount?'+'net_resource='+self.net_resource)#.readline() - #logger.info("Restoring browser settings in AppData dir " + appDataDir) - # create OpenSecurity settings dir on local machine user home /AppData/Roaming - #Cygwin.bashExecute('/usr/bin/mkdir -p \\\"' + appDataDir + '/OpenSecurity\\\"') - # create chromium settings dir on local machine if not existing - #Cygwin.bashExecute('/usr/bin/mkdir -p \\\"' + appDataDir + '/OpenSecurity/chromium\\\"') - # create chromium settings dir on remote machine if not existing - #Cygwin.sshExecute('"mkdir -p \\\"/home/osecuser/.config\\\""', self.ip_addr, 'osecuser', Cygwin.cygPath(self.vmm.getMachineFolder()) + '/' + self.vm_name + '/dvm_key') - #restore settings on vm - #self.restoreFile(appDataDir + '/OpenSecurity/chromium', '/home/osecuser/.config/') - if self.wpad: browser = '\\\"/usr/bin/chromium --proxy-pac-url=\\\"'+self.wpad+'\\\"\\\"' elif self.proxy: