OpenSecurity/bin/start_browsing.pyw
changeset 238 d33edf5c2717
parent 199 26b9a95b0da1
child 240 d7ef04254e9c
     1.1 --- a/OpenSecurity/bin/start_browsing.pyw	Wed Jun 25 19:21:04 2014 +0200
     1.2 +++ b/OpenSecurity/bin/start_browsing.pyw	Tue Oct 28 15:20:42 2014 +0100
     1.3 @@ -38,6 +38,7 @@
     1.4  
     1.5  # local
     1.6  import __init__ as opensecurity
     1.7 +import proxy_getter
     1.8  
     1.9  if sys.platform == 'win32' or sys.platform == 'cygwin':
    1.10      from cygwin import Cygwin
    1.11 @@ -51,17 +52,25 @@
    1.12  if __name__ == "__main__":
    1.13  
    1.14      if not (sys.platform == 'win32' or sys.platform == 'cygwin'):
    1.15 -        QtGui.QMessageBox.critical(self.parent(), 'OpenSecurity Error', 'This action is not supported on this platform.\nSorry.')
    1.16 +        QtGui.QMessageBox.critical(None, 'OpenSecurity Error', 'This action is not supported on this platform.\nSorry.')
    1.17          sys.exit(1)
    1.18     
    1.19      try:
    1.20      
    1.21          # get a proper browsing VM
    1.22          Cygwin.start_X11()
    1.23 +        
    1.24 +        proxy_support = urllib2.ProxyHandler({})
    1.25 +        opener = urllib2.build_opener(proxy_support)
    1.26 +        urllib2.install_opener(opener)
    1.27  
    1.28 -        # TODO: HARDCODED ADDRESS OF OPENSECURITYD
    1.29 -        browsing_vm = urllib2.urlopen('http://127.0.0.1:8080/browsing').readline()
    1.30 -        print('Called http://127.0.0.1:8080/browsing got: ' + str(browsing_vm))
    1.31 +        req_data = ""
    1.32 +        proxy = proxy_getter.getProxySettings()
    1.33 +        if proxy:
    1.34 +            req_data = '?' + urllib.urlencode(proxy) 
    1.35 +        req = 'http://127.0.0.1:8080/browsing'+ req_data
    1.36 +        browsing_vm = urllib2.urlopen(req).readline()
    1.37 +        print('Called '+ req + ' got: ' + str(browsing_vm))
    1.38          
    1.39      except:
    1.40