OpenSecurity/bin/opensecurity_tray.pyw
changeset 165 a1b7a5a48a1e
parent 163 e7fbdaabd0bc
child 193 8d5b7c9ff783
     1.1 --- a/OpenSecurity/bin/opensecurity_tray.pyw	Mon May 19 17:19:47 2014 +0100
     1.2 +++ b/OpenSecurity/bin/opensecurity_tray.pyw	Tue May 20 15:26:03 2014 +0200
     1.3 @@ -32,6 +32,7 @@
     1.4  # imports
     1.5  
     1.6  import argparse
     1.7 +import json
     1.8  import os
     1.9  import subprocess
    1.10  import sys
    1.11 @@ -117,8 +118,10 @@
    1.12  
    1.13              # TODO: HARDCODED ADDRESS OF OPENSECURITYD
    1.14              browsing_vm = urllib2.urlopen('http://127.0.0.1:8080/browsing').readline()
    1.15 +            print('Called http://127.0.0.1:8080/browsing got: ' + str(browsing_vm))
    1.16              
    1.17          except:
    1.18 +            
    1.19              d.hide()
    1.20              QtGui.QApplication.instance().processEvents()
    1.21              QtGui.QMessageBox.critical(None, 'Failed to invoke Safe Internet Browsing', 'OpenSecurity Error')
    1.22 @@ -143,8 +146,24 @@
    1.23          """clicked the launch an application"""
    1.24          dlg_launch_image = os.path.join(sys.path[0], 'ui', 'launch_dialog.py')
    1.25          process_command = [sys.executable, dlg_launch_image]
    1.26 -        print(process_command)
    1.27 -        process = subprocess.Popen(process_command, shell = False)
    1.28 +        process = subprocess.Popen(process_command, shell = False, stdout = subprocess.PIPE)        
    1.29 +        try:
    1.30 +            stdout = process.communicate()[0]
    1.31 +            j = json.loads(stdout)
    1.32 +        except:
    1.33 +            return
    1.34 +
    1.35 +        try:
    1.36 +        
    1.37 +            # get a proper browsing VM
    1.38 +            Cygwin.start_X11()
    1.39 +
    1.40 +            # TODO: HARDCODED ADDRESS OF OPENSECURITYD
    1.41 +            url = 'http://127.0.0.1:8080/sdvms/' + j['vm'] + '/application' + j['application']
    1.42 +            result = urllib2.urlopen(url).readline()
    1.43 +            
    1.44 +        except:
    1.45 +            pass 
    1.46              
    1.47              
    1.48      def clicked_mail(self):