OpenSecurity/bin/vmmanager.py
changeset 19 3111f077646d
parent 18 d7d7b8dee78e
child 21 850b73508550
child 22 ff138e89aa4d
     1.1 --- a/OpenSecurity/bin/vmmanager.py	Fri Dec 06 12:47:53 2013 +0100
     1.2 +++ b/OpenSecurity/bin/vmmanager.py	Fri Dec 06 12:52:34 2013 +0100
     1.3 @@ -9,8 +9,10 @@
     1.4  import subprocess
     1.5  import sys
     1.6  import re
     1.7 +import _winreg
     1.8  from cygwin import Cygwin
     1.9  
    1.10 +
    1.11  DEBUG = True
    1.12  
    1.13  class USBFilter:
    1.14 @@ -38,10 +40,12 @@
    1.15      vmRootName = "SecurityDVM"
    1.16      systemProperties = None
    1.17      cygwin_path = 'c:\\cygwin64\\bin\\'
    1.18 +    vboxManage = 'VBoxManage'
    1.19      
    1.20      def __init__(self):
    1.21          self.systemProperties = self.getSystemProperties()
    1.22          self.cygwin_path = Cygwin.root()
    1.23 +        self.vboxManage = os.path.join(getVBoxManagePath, 'VBoxManage')
    1.24          return
    1.25           
    1.26      def execute(self, cmd):
    1.27 @@ -60,6 +64,17 @@
    1.28                  print res_stderr
    1.29          return result, res_stdout, res_stderr
    1.30      
    1.31 +    def getVBoxManagePath(self):
    1.32 +        """get the path to the VirtualBox installation on this system"""
    1.33 +        p = None
    1.34 +        try:
    1.35 +            k = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\Oracle\VirtualBox')
    1.36 +            p = _winreg.QueryValueEx(k, 'InstallDir')[0]
    1.37 +            _winreg.CloseKey(k)
    1.38 +        except:
    1.39 +            pass
    1.40 +        return p
    1.41 +    
    1.42      # return hosty system properties
    1.43      def getSystemProperties(self):
    1.44          cmd = 'VBoxManage list systemproperties'