1.1 --- a/OpenSecurity/bin/vmmanager.py Thu Jan 09 10:44:42 2014 +0100
1.2 +++ b/OpenSecurity/bin/vmmanager.py Wed Jan 29 14:18:17 2014 +0100
1.3 @@ -80,26 +80,6 @@
1.4
1.5 def isSDVMStarted(self, ip):
1.6 return self.startNotifications.contains(ip)
1.7 -
1.8 - def execute(self, cmd, wait_return=True ):
1.9 - if DEBUG:
1.10 - print('trying to launch: ' + cmd)
1.11 - process = Popen(cmd, stdout=PIPE, stderr=PIPE) #shell = True
1.12 - if DEBUG:
1.13 - print('launched: ' + cmd)
1.14 - if not wait_return:
1.15 - return [0, 'working in background', '']
1.16 - result = process.wait()
1.17 - res_stdout = process.stdout.read();
1.18 - res_stderr = process.stderr.read();
1.19 - if DEBUG:
1.20 - if res_stdout != "":
1.21 - print res_stdout
1.22 - if res_stderr != "":
1.23 - print res_stderr
1.24 - if result !=0:
1.25 - raise VMManagerException(res_stderr)
1.26 - return result, res_stdout, res_stderr
1.27
1.28 def getVBoxManagePath(self):
1.29 """get the path to the VirtualBox installation on this system"""
1.30 @@ -115,7 +95,7 @@
1.31 # return hosty system properties
1.32 def getSystemProperties(self):
1.33 cmd = self.vboxManage + ' list systemproperties'
1.34 - result = self.execute(cmd)
1.35 + result = self.hostExecute(cmd)
1.36 if result[1]=='':
1.37 return None
1.38 props = dict((k.strip(),v.strip().strip('"')) for k,v in (line.split(':', 1) for line in result[1].strip().splitlines()))
1.39 @@ -123,12 +103,13 @@
1.40
1.41 # return the folder containing the guest VMs
1.42 def getDefaultMachineFolder(self):
1.43 - return self.systemProperties["Default machine folder"]
1.44 + machineFolder = self.systemProperties["Default machine folder"]
1.45 + return machineFolder
1.46
1.47 #list the hostonly IFs exposed by the VBox host
1.48 def getHostOnlyIFs(self):
1.49 cmd = 'VBoxManage list hostonlyifs'
1.50 - result = self.execute(cmd)[1]
1.51 + result = self.hostExecute(cmd)[1]
1.52 if result=='':
1.53 return None
1.54 props = dict((k.strip(),v.strip().strip('"')) for k,v in (line.split(':', 1) for line in result.strip().splitlines()))
1.55 @@ -136,7 +117,7 @@
1.56
1.57 def listRSDS(self):
1.58 cmd = 'VBoxManage list usbhost'
1.59 - results = self.execute(cmd)[1]
1.60 + results = self.hostExecute(cmd)[1]
1.61 results = results.split('Host USB Devices:')[1].strip()
1.62
1.63 items = list( "UUID:"+result for result in results.split('UUID:') if result != '')
1.64 @@ -160,7 +141,14 @@
1.65 # list all existing VMs registered with VBox
1.66 def listVM(self):
1.67 cmd = 'VBoxManage list vms'
1.68 - result = self.execute(cmd)[1]
1.69 + result = self.hostExecute(cmd)[1]
1.70 + vms = list(k.strip().strip('"') for k,_ in (line.split(' ') for line in result.splitlines()))
1.71 + return vms
1.72 +
1.73 + # list running VMs
1.74 + def listRunningVMS(self):
1.75 + cmd = 'VBoxManage list runningvms'
1.76 + result = self.hostExecute(cmd)[1]
1.77 vms = list(k.strip().strip('"') for k,_ in (line.split(' ') for line in result.splitlines()))
1.78 return vms
1.79
1.80 @@ -194,63 +182,155 @@
1.81 # configures hostonly networking and DHCP server. requires admin rights
1.82 def configureHostNetworking(self):
1.83 #cmd = 'vboxmanage list hostonlyifs'
1.84 - #self.execute(cmd)
1.85 + #self.hostExecute(cmd)
1.86 #cmd = 'vboxmanage hostonlyif remove \"VirtualBox Host-Only Ethernet Adapter\"'
1.87 - #self.execute(cmd)
1.88 + #self.hostExecute(cmd)
1.89 #cmd = 'vboxmanage hostonlyif create'
1.90 - #self.execute(cmd)
1.91 + #self.hostExecute(cmd)
1.92 cmd = 'VBoxManage hostonlyif ipconfig \"VirtualBox Host-Only Ethernet Adapter\" --ip 192.168.56.1 --netmask 255.255.255.0'
1.93 - self.execute(cmd)
1.94 + self.hostExecute(cmd)
1.95 #cmd = 'vboxmanage dhcpserver add'
1.96 - #self.execute(cmd)
1.97 + #self.hostExecute(cmd)
1.98 cmd = 'VBoxManage dhcpserver modify --ifname \"VirtualBox Host-Only Ethernet Adapter\" --ip 192.168.56.100 --netmask 255.255.255.0 --lowerip 192.168.56.101 --upperip 192.168.56.200'
1.99 - self.execute(cmd)
1.100 + self.hostExecute(cmd)
1.101
1.102 #create new virtual machine instance based on template vm named SecurityDVM (\SecurityDVM\SecurityDVM.vmdk)
1.103 def createVM(self, vm_name):
1.104 hostonly_if = self.getHostOnlyIFs()
1.105 + cmd = 'VBoxManage createvm --name ' + vm_name + ' --ostype Debian --register'
1.106 + self.hostExecute(cmd)
1.107 + cmd = 'VBoxManage modifyvm ' + vm_name + ' --memory 512 --vram 10 --cpus 1 --usb on --usbehci on --nic1 hostonly --hostonlyadapter1 \"' + hostonly_if['Name'] + '\" --nic2 nat'
1.108 + self.hostExecute(cmd)
1.109 + cmd = 'VBoxManage storagectl ' + vm_name + ' --name SATA --add sata --portcount 2'
1.110 + self.hostExecute(cmd)
1.111 + return
1.112 +
1.113 + # attach storage image to controller
1.114 + def storageAttach(self, vm_name):
1.115 + if self.isStorageAttached(vm_name):
1.116 + self.storageDetach(vm_name)
1.117 machineFolder = self.getDefaultMachineFolder()
1.118 - cmd = 'VBoxManage createvm --name ' + vm_name + ' --ostype Debian --register'
1.119 - self.execute(cmd)
1.120 - cmd = 'VBoxManage modifyvm ' + vm_name + ' --memory 512 --vram 10 --cpus 1 --usb on --usbehci on --nic1 hostonly --hostonlyadapter1 \"' + hostonly_if['Name'] + '\" --nic2 nat'
1.121 - self.execute(cmd)
1.122 - cmd = 'VBoxManage storagectl ' + vm_name + ' --name contr1 --add sata --portcount 2'
1.123 - self.execute(cmd)
1.124 - cmd = 'VBoxManage storageattach ' + vm_name + ' --storagectl contr1 --port 0 --device 0 --type hdd --medium \"'+ machineFolder + '\SecurityDVM\SecurityDVM.vmdk\"' #--mtype immutable
1.125 - self.execute(cmd)
1.126 + cmd = 'VBoxManage storageattach ' + vm_name + ' --storagectl SATA --port 0 --device 0 --type hdd --medium \"'+ machineFolder + '\SecurityDVM\SecurityDVM.vmdk\"'
1.127 + self.hostExecute(cmd)
1.128 return
1.129
1.130 + # return true if storage is attached
1.131 + def isStorageAttached(self, vm_name):
1.132 + info = self.getVMInfo(vm_name)
1.133 + return (info['SATA-0-0']!='none')
1.134 +
1.135 + # detach storage from controller
1.136 + def storageDetach(self, vm_name):
1.137 + if self.isStorageAttached(vm_name):
1.138 + cmd = 'VBoxManage storageattach ' + vm_name + ' --storagectl SATA --port 0 --device 0 --type hdd --medium none'
1.139 + self.hostExecute(cmd)
1.140 + return
1.141 +
1.142 + def changeStorageType(self, filename, type):
1.143 + cmd = 'VBoxManage modifyhd \"' + filename + '\" --type ' + type
1.144 + self.hostExecute(cmd)
1.145 + return
1.146 +
1.147 + # list storage snaphots for VM
1.148 + def updateTemplate(self):
1.149 + self.poweroffVM('SecurityDVM')
1.150 + self.waitShutdown('SecurityDVM')
1.151 +
1.152 + # check for updates
1.153 + self.genCertificateISO('SecurityDVM')
1.154 + self.attachCertificateISO('SecurityDVM')
1.155 +
1.156 + self.storageDetach('SecurityDVM')
1.157 + cmd = 'VBoxManage list hdds'
1.158 + results = self.hostExecute(cmd)[1]
1.159 + results = results.replace('Parent UUID', 'Parent')
1.160 + items = list( "UUID:"+result for result in results.split('UUID:') if result != '')
1.161 +
1.162 + snaps = dict()
1.163 + for item in items:
1.164 + #print item
1.165 + props = dict()
1.166 + for line in item.splitlines():
1.167 + if line != "":
1.168 + k,v = line[:line.index(':')].strip(), line[line.index(':')+1:].strip()
1.169 + props[k] = v;
1.170 + snaps[props['UUID']] = props
1.171 +
1.172 + machineFolder = self.getDefaultMachineFolder()
1.173 + template_storage = machineFolder + '\SecurityDVM\SecurityDVM.vmdk'
1.174 +
1.175 + # find template uuid
1.176 + template_uuid = ''
1.177 + for hdd in snaps.values():
1.178 + if hdd['Location'] == template_storage:
1.179 + template_uuid = hdd['UUID']
1.180 + print 'found parent uuid ' + template_uuid
1.181 +
1.182 + # remove snapshots
1.183 + for hdd in snaps.values():
1.184 + if hdd['Parent'] == template_uuid:
1.185 + #template_uuid = hdd['UUID']
1.186 + print 'removing snapshot ' + hdd['UUID']
1.187 + cmd = 'VBoxManage closemedium disk {' + hdd['UUID'] + '} --delete'
1.188 + results = self.hostExecute(cmd)[1]
1.189 + # parse result 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
1.190 +
1.191 + self.changeStorageType(template_storage,'normal')
1.192 + self.storageAttach('SecurityDVM')
1.193 + self.startVM('SecurityDVM')
1.194 + self.waitStartup('SecurityDVM')
1.195 + self.guestExecute('SecurityDVM', 'sudo apt-get -y update' )
1.196 + self.guestExecute('SecurityDVM', 'sudo apt-get -y upgrade' )
1.197 + self.stopVM('SecurityDVM')
1.198 + self.waitShutdown('SecurityDVM')
1.199 + self.storageDetach('SecurityDVM')
1.200 + self.changeStorageType(template_storage,'immutable')
1.201 + self.storageAttach('SecurityDVM')
1.202 +
1.203 +
1.204 #remove VM from the system. should be used on VMs returned by listSDVMs
1.205 def removeVM(self, vm_name):
1.206 print('removing ' + vm_name)
1.207 cmd = 'VBoxManage unregistervm ' + vm_name + ' --delete'
1.208 - print self.execute(cmd)
1.209 + print self.hostExecute(cmd)
1.210 machineFolder = self.getDefaultMachineFolder()
1.211 cmd = self.cygwin_path + 'bash.exe --login -c \"rm -rf ' + machineFolder + '\\' + vm_name + '*\"'
1.212 - print self.execute(cmd)
1.213 + print self.hostExecute(cmd)
1.214
1.215 # start VM
1.216 def startVM(self, vm_name):
1.217 print('starting ' + vm_name)
1.218 cmd = 'VBoxManage startvm ' + vm_name + ' --type headless'
1.219 - result = self.execute(cmd)
1.220 + result = self.hostExecute(cmd)
1.221 while not string.find(str(result), 'successfully started',):
1.222 print "Failed to start SDVM: ", vm_name, " retrying"
1.223 time.sleep(1)
1.224 - result = self.execute(cmd)
1.225 + result = self.hostExecute(cmd)
1.226 return result[0]
1.227 -
1.228 - # stop VM
1.229 +
1.230 + # return wether VM is running or not
1.231 + def isVMRunning(self, vm_name):
1.232 + return vm_name in self.listRunningVMS()
1.233 +
1.234 + # stop VM
1.235 def stopVM(self, vm_name):
1.236 print('stopping ' + vm_name)
1.237 + cmd = 'sudo shutdown -h now'
1.238 + self.guestExecute('SecurityDVM', cmd)
1.239 +
1.240 + # poweroff VM
1.241 + def poweroffVM(self, vm_name):
1.242 + if not self.isVMRunning(vm_name):
1.243 + return
1.244 + print('powering off ' + vm_name)
1.245 cmd = 'VBoxManage controlvm ' + vm_name + ' poweroff'
1.246 - self.execute(cmd)
1.247 + self.hostExecute(cmd)
1.248
1.249 # return the hostOnly IP for a running guest
1.250 def getHostOnlyIP(self, vm_name):
1.251 print('gettting hostOnly IP address ' + vm_name)
1.252 cmd = 'VBoxManage guestproperty get ' + vm_name + ' /VirtualBox/GuestInfo/Net/0/V4/IP'
1.253 - result = self.execute(cmd)
1.254 + result = self.hostExecute(cmd)
1.255 if result=='':
1.256 return None
1.257 result = result[1]
1.258 @@ -261,14 +341,14 @@
1.259 # attach removable storage device to VM by provision of filter
1.260 def attachRSD(self, vm_name, rsd_filter):
1.261 cmd = 'VBoxManage usbfilter add 0 --target ' + vm_name + ' --name OpenSecurityRSD --vendorid ' + rsd_filter.vendorid + ' --productid ' + rsd_filter.productid + ' --revision ' + rsd_filter.revision
1.262 - print self.execute(cmd)
1.263 + print self.hostExecute(cmd)
1.264
1.265
1.266 # return the description set for an existing VM
1.267 def getVMInfo(self, vm_name):
1.268 cmd = 'VBoxManage showvminfo ' + vm_name + ' --machinereadable'
1.269 - results = self.execute(cmd)[1]
1.270 - props = dict((k.strip(),v.strip().strip('"')) for k,v in (line.split('=', 1) for line in results.splitlines()))
1.271 + results = self.hostExecute(cmd)[1]
1.272 + props = dict((k.strip().strip('"'),v.strip().strip('"')) for k,v in (line.split('=', 1) for line in results.splitlines()))
1.273 return props
1.274
1.275 # return the configured USB filter for an existing VM
1.276 @@ -284,31 +364,40 @@
1.277 #generates ISO containing authorized_keys for use with guest VM
1.278 def genCertificateISO(self, vm_name):
1.279 machineFolder = self.getDefaultMachineFolder()
1.280 + machineFolder = self.cygwinPath(machineFolder)
1.281 + # remove .ssh folder if exists
1.282 + cmd = self.cygwin_path+'bash.exe --login -c \"rm -rf \\\"' + machineFolder + '/' + vm_name + '/.ssh\\\"\"'
1.283 + self.hostExecute(cmd)
1.284 + # remove .ssh folder if exists
1.285 + cmd = self.cygwin_path+'bash.exe --login -c \"rm -rf \\\"' + machineFolder + '/' + vm_name + '/dvm_key\\\"\"'
1.286 + self.hostExecute(cmd)
1.287 # create .ssh folder in vm_name
1.288 - cmd = self.cygwin_path+'bash.exe --login -c \"mkdir -p \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\\"\"'
1.289 - self.execute(cmd)
1.290 + cmd = self.cygwin_path+'bash.exe --login -c \"mkdir -p \\\"' + machineFolder + '/' + vm_name + '/.ssh\\\"\"'
1.291 + self.hostExecute(cmd)
1.292 # generate dvm_key pair in vm_name / .ssh
1.293 - cmd = self.cygwin_path+'bash.exe --login -c \"ssh-keygen -q -t rsa -N \\"\\" -C \\\"' + vm_name + '\\\" -f \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\dvm_key\\\"\"' #'echo -e "y\\n" |',
1.294 - self.execute(cmd)
1.295 - # set permissions for keys
1.296 - #TODO: test without chmod
1.297 - cmd = self.cygwin_path+'bash.exe --login -c \"chmod 500 \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\*\\\"\"'
1.298 - self.execute(cmd)
1.299 + cmd = self.cygwin_path+'bash.exe --login -c \"ssh-keygen -q -t rsa -N \\"\\" -C \\\"' + vm_name + '\\\" -f \\\"' + machineFolder + '/' + vm_name + '/.ssh/dvm_key\\\"\"' #'echo -e "y\\n" |',
1.300 + self.hostExecute(cmd)
1.301 # move out private key
1.302 - cmd = self.cygwin_path+'bash.exe --login -c \"mv \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\dvm_key\\\" \\\"' + machineFolder + '\\' + vm_name + '\\\"'
1.303 - self.execute(cmd)
1.304 + cmd = self.cygwin_path+'bash.exe --login -c \"mv \\\"' + machineFolder + '/' + vm_name + '/.ssh/dvm_key\\\" \\\"' + machineFolder + '/' + vm_name + '\\\"'
1.305 + self.hostExecute(cmd)
1.306 + # set permissions for private key
1.307 + cmd = self.cygwin_path+'bash.exe --login -c \"chmod 500 \\\"' + machineFolder + '/' + vm_name + '/dvm_key\\\"\"'
1.308 + self.hostExecute(cmd)
1.309 # rename public key to authorized_keys
1.310 - cmd = self.cygwin_path+'bash.exe --login -c \"mv \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\dvm_key.pub\\\" \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\authorized_keys\\\"'
1.311 - self.execute(cmd)
1.312 + cmd = self.cygwin_path+'bash.exe --login -c \"mv \\\"' + machineFolder + '/' + vm_name + '/.ssh/dvm_key.pub\\\" \\\"' + machineFolder + '/' + vm_name + '/.ssh/authorized_keys\\\"'
1.313 + self.hostExecute(cmd)
1.314 + # set permissions for authorized_keys
1.315 + cmd = self.cygwin_path+'bash.exe --login -c \"chmod 500 \\\"' + machineFolder + '/' + vm_name + '/.ssh/authorized_keys\\\"\"'
1.316 + self.hostExecute(cmd)
1.317 # generate iso image with .ssh/authorized keys
1.318 - cmd = self.cygwin_path+'bash.exe --login -c \"/usr/bin/genisoimage -J -R -o \\\"' + machineFolder + '\\' + vm_name + '\\'+ vm_name + '.iso\\\" \\\"' + machineFolder + '\\' + vm_name + '\\.ssh\\\"\"'
1.319 - self.execute(cmd)
1.320 + cmd = self.cygwin_path+'bash.exe --login -c \"/usr/bin/genisoimage -J -R -o \\\"' + machineFolder + '/' + vm_name + '/'+ vm_name + '.iso\\\" \\\"' + machineFolder + '/' + vm_name + '/.ssh\\\"\"'
1.321 + self.hostExecute(cmd)
1.322
1.323 # attaches generated ssh public cert to guest vm
1.324 def attachCertificateISO(self, vm_name):
1.325 machineFolder = self.getDefaultMachineFolder()
1.326 - cmd = 'vboxmanage storageattach ' + vm_name + ' --storagectl contr1 --port 1 --device 0 --type dvddrive --mtype readonly --medium \"' + machineFolder + '\\' + vm_name + '\\'+ vm_name + '.iso\"'
1.327 - result = self.execute(cmd)
1.328 + cmd = 'vboxmanage storageattach ' + vm_name + ' --storagectl SATA --port 1 --device 0 --type dvddrive --mtype readonly --medium \"' + machineFolder + '\\' + vm_name + '\\'+ vm_name + '.iso\"'
1.329 + result = self.hostExecute(cmd)
1.330 return result
1.331
1.332 handleDeviceChangeLock = threading.Lock()
1.333 @@ -348,6 +437,23 @@
1.334 VMManager.handleDeviceChangeLock.release()
1.335 return new_ip
1.336
1.337 + # wait for machine to come up
1.338 + def waitStartup(self, vm_name):
1.339 + new_ip = None
1.340 + while new_ip == None:
1.341 + time.sleep(1)
1.342 + new_ip = self.getHostOnlyIP(vm_name)
1.343 + while new_ip not in self.startNotifications:
1.344 + time.sleep(1)
1.345 + return
1.346 +
1.347 + # wait for machine to shutdown
1.348 + def waitShutdown(self, vm_name):
1.349 + while vm_name in self.listRunningVMS():
1.350 + time.sleep(1)
1.351 + return
1.352 +
1.353 + # handles browsing request
1.354 def handleBrowsingRequest(self):
1.355 if VMManager.handleDeviceChangeLock.acquire(True):
1.356 new_ip = None
1.357 @@ -356,12 +462,7 @@
1.358 self.genCertificateISO(new_sdvm)
1.359 self.attachCertificateISO(new_sdvm)
1.360 self.startVM(new_sdvm)
1.361 - # wait for machine to come up
1.362 - while new_ip == None:
1.363 - time.sleep(1)
1.364 - new_ip = self.getHostOnlyIP(new_sdvm)
1.365 - while new_ip not in self.startNotifications:
1.366 - time.sleep(1)
1.367 + self.waitStartup(new_sdvm)
1.368 if new_ip != None:
1.369 self.mapNetworkDrive('g:', '\\\\' + new_ip + '\\Download', None, None)
1.370 #TODO: cleanup notifications somwhere else (eg. machine shutdown)
1.371 @@ -369,17 +470,44 @@
1.372 VMManager.handleDeviceChangeLock.release()
1.373 return new_sdvm
1.374
1.375 + def cygwinPath(self, path):
1.376 + # TODO: test if env ist cygwin
1.377 + cmd = self.cygwin_path + 'bash.exe --login -c \"cygpath -u \\\"' + path + '\\\"\"'
1.378 + return self.hostExecute(cmd)[1].rstrip('\n')
1.379 +
1.380 + #executes command on host system
1.381 + def hostExecute(self, cmd, wait_return=True ):
1.382 + if DEBUG:
1.383 + print('trying to launch: ' + cmd)
1.384 + process = Popen(cmd, stdout=PIPE, stderr=PIPE) #shell = True
1.385 + if DEBUG:
1.386 + print('launched: ' + cmd)
1.387 + if not wait_return:
1.388 + return [0, 'working in background', '']
1.389 + result = process.wait()
1.390 + res_stdout = process.stdout.read();
1.391 + res_stderr = process.stderr.read();
1.392 + if DEBUG:
1.393 + if res_stdout != "":
1.394 + print res_stdout
1.395 + if res_stderr != "":
1.396 + print res_stderr
1.397 + if result !=0:
1.398 + raise VMManagerException(res_stderr)
1.399 + return result, res_stdout, res_stderr
1.400 +
1.401 # executes command over ssh on guest vm
1.402 - def sshGuestExecute(self, vm_name, prog, user_name='osecuser'):
1.403 + def guestExecute(self, vm_name, prog, user_name='osecuser'):
1.404 # get vm ip
1.405 address = self.getHostOnlyIP(vm_name)
1.406 machineFolder = self.getDefaultMachineFolder()
1.407 - # run command
1.408 - cmd = self.cygwin_path+'bash.exe --login -c \"ssh -i \\\"' + machineFolder + '\\' + vm_name + '\\dvm_key\\\" ' + user_name + '@' + address + ' ' + prog + '\"'
1.409 - return self.execute(cmd)
1.410 + machineFolder = self.cygwinPath(machineFolder)
1.411 + # run command //mintty.exe -e
1.412 + cmd = self.cygwin_path + 'bash.exe --login -c \"/usr/bin/ssh -v -i \\\"' + machineFolder + '/' + vm_name + '/dvm_key\\\" ' + user_name + '@' + address + ' ' + prog + '\"'
1.413 + return self.hostExecute(cmd)
1.414
1.415 # executes command over ssh on guest vm with X forwarding
1.416 - def sshGuestX11Execute(self, vm_name, prog, user_name='osecuser'):
1.417 + def guestExecuteX11(self, vm_name, prog, user_name='osecuser'):
1.418 #TODO: verify if X server is running on user account
1.419 #TODO: set DISPLAY accordingly
1.420 address = self.getHostOnlyIP(vm_name)
1.421 @@ -447,6 +575,7 @@
1.422 return -1
1.423 return 1
1.424
1.425 +
1.426 if __name__ == '__main__':
1.427 man = VMManager.getInstance()
1.428 #man.removeVM('SecurityDVM0')
1.429 @@ -463,9 +592,22 @@
1.430 #man.attachCertificateISO(new_vm)
1.431
1.432 #man.attachCertificateISO(vm_name)
1.433 - #man.sshGuestExecute(vm_name, "ls")
1.434 - man.sshGuestX11Execute('SecurityDVM1', '/usr/bin/iceweasel')
1.435 - time.sleep(60)
1.436 + #man.guestExecute(vm_name, "ls")
1.437 + #man.sshGuestX11Execute('SecurityDVM1', '/usr/bin/iceweasel')
1.438 + #time.sleep(60)
1.439 + #print man.cygwinPath("C:\Users\BarthaM\VirtualBox VMs\SecurityDVM\.ssh\*")
1.440 + #man.genCertificateISO('SecurityDVM')
1.441 + #man.attachCertificateISO('SecurityDVM')
1.442 + #man.isStorageAttached('SecurityDVM')
1.443 + man.guestExecute('SecurityDVM', 'sudo apt-get -y update')
1.444 + #man.guestExecute('SecurityDVM', 'sudo apt-get -y upgrade' )
1.445 +
1.446 + #man.stopVM('SecurityDVM')
1.447 + #man.storageDetach('SecurityDVM')
1.448 + #man.changeStorageType('C:\Users\BarthaM\VirtualBox VMs\SecurityDVM\SecurityDVM.vmdk','immutable')
1.449 + #man.storageAttach('SecurityDVM')
1.450 +
1.451 +
1.452 #cmd = "c:\\cygwin64\\bin\\bash.exe --login -c \"/bin/ls\""
1.453 #man.execute(cmd)
1.454
1.455 \ No newline at end of file