1.1 --- a/OpenSecurity/bin/opensecurityd.pyw Wed Jun 25 20:42:12 2014 +0200
1.2 +++ b/OpenSecurity/bin/opensecurityd.pyw Wed Jun 25 20:46:31 2014 +0200
1.3 @@ -241,7 +241,7 @@
1.4 def GET(self, name):
1.5 log_call(web.ctx.environ)
1.6 global gvm_mgr
1.7 - return gvm_mgr.getVMInfo(name)
1.8 + return json.dumps(gvm_mgr.getVMInfo(name), indent = 4)
1.9
1.10 def DELETE(self, name):
1.11 log_call(web.ctx.environ)
1.12 @@ -311,7 +311,7 @@
1.13 """get the list of SDVMs"""
1.14 log_call(web.ctx.environ)
1.15 global gvm_mgr
1.16 - return gvm_mgr.listSDVM()
1.17 + return str(gvm_mgr.listSDVM()).replace("'",'"')
1.18
1.19 def POST(self):
1.20 """create a new SDVM"""
2.1 --- a/OpenSecurity/bin/ui/configure_dialog.py Wed Jun 25 20:42:12 2014 +0200
2.2 +++ b/OpenSecurity/bin/ui/configure_dialog.py Wed Jun 25 20:46:31 2014 +0200
2.3 @@ -180,7 +180,6 @@
2.4 self.ui.edtStatus.setEnabled(False);
2.5 self.ui.edtVersion.setEnabled(False);
2.6 self.ui.tvTemplate.clear()
2.7 - self.ui.tvMachines.clear()
2.8
2.9 try:
2.10
2.11 @@ -202,15 +201,52 @@
2.12 i.setText(2, str(j['initial_template']['size']))
2.13 i.setText(3, j['initial_template']['path'])
2.14
2.15 - # get machines
2.16 - j = json.load(urllib2.urlopen('http://127.0.0.1:8080/vms'))
2.17 - for m in j:
2.18 - i = QtGui.QTreeWidgetItem(self.ui.tvMachines)
2.19 - i.setText(0, m)
2.20 -
2.21 except:
2.22 pass
2.23
2.24 + # trigger machine update
2.25 + self.update_machines()
2.26 +
2.27 +
2.28 + def update_machines(self):
2.29 +
2.30 + """Update the machines view"""
2.31 + self.ui.tvMachines.clear()
2.32 + self._icon_machine = QtGui.QIcon()
2.33 + self._icon_machine.addPixmap(QtGui.QPixmap(":/opensecurity/gfx/cpu.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
2.34 + self._icon_property = QtGui.QIcon()
2.35 + self._icon_property.addPixmap(QtGui.QPixmap(":/opensecurity/gfx/configure.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
2.36 + self._icon_network = QtGui.QIcon()
2.37 + self._icon_network.addPixmap(QtGui.QPixmap(":/opensecurity/gfx/network-workgroup.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
2.38 +
2.39 +
2.40 + #try:
2.41 +
2.42 + # get machines
2.43 + machines = json.load(urllib2.urlopen('http://127.0.0.1:8080/sdvms'))
2.44 + for m in machines:
2.45 + i = QtGui.QTreeWidgetItem(self.ui.tvMachines)
2.46 + i.setIcon(0, self._icon_machine)
2.47 + i.setText(0, m)
2.48 +
2.49 + properties = json.load(urllib2.urlopen('http://127.0.0.1:8080/sdvms/' + m))
2.50 + for p in properties:
2.51 + j = QtGui.QTreeWidgetItem(i)
2.52 + j.setIcon(0, self._icon_property)
2.53 + j.setText(0, p)
2.54 + j.setText(1, properties[p])
2.55 +
2.56 + ip = urllib2.urlopen('http://127.0.0.1:8080/sdvms/' + m + '/ip')
2.57 + j = QtGui.QTreeWidgetItem(i)
2.58 + j.setIcon(0, self._icon_network)
2.59 + j.setText(0, 'ip')
2.60 + j.setText(1, ip.read())
2.61 +
2.62 +
2.63 + #except:
2.64 + # pass
2.65 +
2.66 +
2.67
2.68 def update_progress(self):
2.69