# HG changeset patch # User BarthaM@N3SIM1218.D03.arc.local # Date 1411573243 -3600 # Node ID a4fb6694e6fe104975ad3cef54ec01779bbd41dd # Parent ac227c9dc244598c0bf85e5cb08446f055b4bd25 Added WPAD proxy support. Not fully tested diff -r ac227c9dc244 -r a4fb6694e6fe OpenSecurity/bin/opensecurity_tray.pyw --- a/OpenSecurity/bin/opensecurity_tray.pyw Fri Sep 12 12:16:51 2014 +0200 +++ b/OpenSecurity/bin/opensecurity_tray.pyw Wed Sep 24 16:40:43 2014 +0100 @@ -119,6 +119,9 @@ except EnvironmentError: break _winreg.CloseKey(aKey) + + if 'AutoConfigURL' in reg_entries.keys(): + return {'ProxyAutoConfigURL': reg_entries['AutoConfigURL']} if 'ProxyEnable' in reg_entries.keys() and reg_entries['ProxyEnable'] == 1: proxy_search = re.search(r"(?<=http=)(?P.*?)(?=;)", reg_entries['ProxyServer']) @@ -127,6 +130,7 @@ if 'ProxyServer' in proxies.keys(): # found http proxy return {'ProxyServer': proxies['ProxyServer']} return {'ProxyServer': reg_entries['ProxyServer']} + return None def clicked_browser(self): diff -r ac227c9dc244 -r a4fb6694e6fe OpenSecurity/bin/opensecurityd.pyw --- a/OpenSecurity/bin/opensecurityd.pyw Fri Sep 12 12:16:51 2014 +0200 +++ b/OpenSecurity/bin/opensecurityd.pyw Wed Sep 24 16:40:43 2014 +0100 @@ -34,9 +34,9 @@ # imports import json -import os +#import os import os.path -import subprocess +#import subprocess import sys import tempfile import web @@ -102,9 +102,12 @@ global gvm_mgr try: proxy = None + wpad = None if 'ProxyServer' in args: proxy = args['ProxyServer'] - result = gvm_mgr.handleBrowsingRequest(proxy) + if 'ProxyAutoConfigURL' in args: + wpad = args['ProxyAutoConfigURL'] + result = gvm_mgr.handleBrowsingRequest(proxy, wpad) return result except: raise web.internalerror() @@ -258,7 +261,7 @@ global gvm_mgr command = '/' + command showTrayMessage('Launching application in isolated VM...', 7000) - result = Cygwin.sshExecuteX11(command, gvm_mgr.getHostOnlyIP(name), 'osecuser', Cygwin.cygPath(gvm_mgr.getMachineFolder()) + '/' + name + '/dvm_key' ) + Cygwin.sshExecuteX11(command, gvm_mgr.getHostOnlyIP(name), 'osecuser', Cygwin.cygPath(gvm_mgr.getMachineFolder()) + '/' + name + '/dvm_key' ) return 'Command ' + str(command) + ' started on VM "' + name + '" with IP ' + gvm_mgr.getHostOnlyIP(name) diff -r ac227c9dc244 -r a4fb6694e6fe OpenSecurity/bin/vmmanager.pyw --- a/OpenSecurity/bin/vmmanager.pyw Fri Sep 12 12:16:51 2014 +0200 +++ b/OpenSecurity/bin/vmmanager.pyw Wed Sep 24 16:40:43 2014 +0100 @@ -740,9 +740,9 @@ return network_drives # handles browsing request - def handleBrowsingRequest(self, proxy): + def handleBrowsingRequest(self, proxy, wpad): showTrayMessage('Starting Secure Browsing...', 7000) - handler = BrowsingHandler(self, proxy) + handler = BrowsingHandler(self, proxy, wpad) handler.start() return 'ok' @@ -958,20 +958,25 @@ class BrowsingHandler(threading.Thread): vmm = None proxy = None - def __init__(self, vmmanager, proxy): + wpad = None + def __init__(self, vmmanager, proxy, wpad): threading.Thread.__init__(self) self.vmm = vmmanager self.proxy = proxy + self.wpad = wpad def run(self): #browser = '\\\"/usr/bin/chromium; pidof dbus-launch | xargs kill\\\"' #browser = '\\\"/usr/bin/chromium\\\"' try: - if self.proxy: + if self.wpad: + browser = '\\\"/usr/bin/chromium --proxy-pac-url=\\\"'+self.wpad+'\\\"\\\"' + elif self.proxy: browser = '\\\"export http_proxy='+self.proxy+'; /usr/bin/chromium\\\"' else: browser = '\\\"/usr/bin/chromium\\\"' + self.vmm.browsingManager.started.wait() result = Cygwin.sshExecuteX11(browser, self.vmm.browsingManager.ip_addr, 'osecuser', Cygwin.cygPath(self.vmm.getMachineFolder()) + '/' + self.vmm.browsingManager.vm_name + '/dvm_key') self.vmm.backupFile('/home/osecuser/.config/chromium', self.vmm.browsingManager.appDataDir + '/OpenSecurity/')