1.1 --- a/OpenSecurity/bin/opensecurityd.py Fri Dec 06 14:29:09 2013 +0100
1.2 +++ b/OpenSecurity/bin/opensecurityd.py Fri Dec 06 14:32:35 2013 +0100
1.3 @@ -37,7 +37,8 @@
1.4 import subprocess
1.5 import sys
1.6 import web
1.7 -from vmmanager.vmmanager import VMManager
1.8 +
1.9 +from vmmanager import VMManager
1.10
1.11 # local
1.12 from environment import Environment
1.13 @@ -52,7 +53,8 @@
1.14 """All the URLs we know mapping to class handler"""
1.15 opensecurity_urls = (
1.16 '/device_change', 'os_device_change', # http://localhost:8080/device_change GET
1.17 - '/sdvms', 'os_sdvms', # http://localhost:8080/sdvms GET, PUT, DELETE
1.18 + '/sdvms', 'os_sdvms', # http://localhost:8080/sdvms GET, PUT
1.19 + '/sdvms/(.*)', 'os_sdvm', # http://localhost:8080/sdvms GET, DELETE
1.20 '/vms', 'os_vms', # http://localhost:8080/vms GET
1.21 '/vms/(.*)', 'os_vm', # http://localhost:8080/vms/[VMNAME] GET
1.22 '/', 'os_root' # http://localhost:8080/ GET
1.23 @@ -78,6 +80,17 @@
1.24 return "os_device_change"
1.25
1.26
1.27 +class os_sdvm:
1.28 + """OpenSecurity '/sdvms/[VM]' handler"""
1.29 +
1.30 + def GET(self, name):
1.31 + return gvm_mgr.getVMInfo(name)
1.32 +
1.33 +
1.34 + def DELETE(self, name):
1.35 + return gvm_mgr.removeVM(name)
1.36 +
1.37 +
1.38 class os_sdvms:
1.39 """OpenSecurity '/sdvms' handler"""
1.40
1.41 @@ -87,24 +100,14 @@
1.42
1.43 def PUT(self):
1.44 """create a new SDVM"""
1.45 - print("os_sdvms:PUT - 1")
1.46 - # pick the vm-name
1.47 - args = web.input()
1.48 - if not "name" in args:
1.49 - raise web.badrequest()
1.50 - print("os_sdvms:PUT - 2")
1.51 -
1.52 - return gvm_mgr.createVM(args.name)
1.53 -
1.54 - def DELETE(self):
1.55 - """remove a new SDVM"""
1.56 +
1.57 # pick the vm-name
1.58 args = web.input()
1.59 if not "name" in args:
1.60 raise web.badrequest()
1.61
1.62 - return gvm_mgr.removeVM(args.name)
1.63 -
1.64 + return gvm_mgr.createVM(args.name)
1.65 +
1.66 class os_vm:
1.67 """OpenSecurity '/vms/[VM]' handler"""
1.68
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/OpenSecurity/bin/os-admind.bat Fri Dec 06 14:32:35 2013 +0100
2.3 @@ -0,0 +1,4 @@
2.4 +@echo off
2.5 +cd %0%\..
2.6 +C:\Python27\python opensecurityd.py 8080
2.7 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/OpenSecurity/bin/os-clientd.bat Fri Dec 06 14:32:35 2013 +0100
3.3 @@ -0,0 +1,3 @@
3.4 +@echo off
3.5 +cd %0%\..
3.6 +C:\Python27\python opensecurity_client_restful_server.py 8090
3.7 \ No newline at end of file
4.1 --- a/OpenSecurity/bin/vmmanager.py Fri Dec 06 14:29:09 2013 +0100
4.2 +++ b/OpenSecurity/bin/vmmanager.py Fri Dec 06 14:32:35 2013 +0100
4.3 @@ -43,9 +43,9 @@
4.4 vboxManage = 'VBoxManage'
4.5
4.6 def __init__(self):
4.7 - self.systemProperties = self.getSystemProperties()
4.8 self.cygwin_path = os.path.join(Cygwin.root(), 'bin')
4.9 self.vboxManage = os.path.join(self.getVBoxManagePath(), 'VBoxManage')
4.10 + self.systemProperties = self.getSystemProperties()
4.11 return
4.12
4.13 def execute(self, cmd):
4.14 @@ -77,7 +77,7 @@
4.15
4.16 # return hosty system properties
4.17 def getSystemProperties(self):
4.18 - cmd = vboxManage + ' list systemproperties'
4.19 + cmd = self.vboxManage + ' list systemproperties'
4.20 result = self.execute(cmd)
4.21 if result[1]=='':
4.22 return None
5.1 --- a/OpenSecurity/test/check-server.bat Fri Dec 06 14:29:09 2013 +0100
5.2 +++ b/OpenSecurity/test/check-server.bat Fri Dec 06 14:32:35 2013 +0100
5.3 @@ -1,2 +1,2 @@
5.4 @echo off
5.5 -..\cygwin\bin\curl -X GET http://127.0.0.1:8080/
5.6 \ No newline at end of file
5.7 +..\cygwin\bin\curl --get http://127.0.0.1:8080/
5.8 \ No newline at end of file
6.1 --- a/OpenSecurity/test/create-security-vm.bat Fri Dec 06 14:29:09 2013 +0100
6.2 +++ b/OpenSecurity/test/create-security-vm.bat Fri Dec 06 14:32:35 2013 +0100
6.3 @@ -1,2 +1,2 @@
6.4 @echo off
6.5 -../cygwin/bin/curl -X PUT -d name='Test' http://127.0.0.1:8080/sdvms
6.6 \ No newline at end of file
6.7 +..\cygwin\bin\curl -X PUT --data "name=Test" http://127.0.0.1:8080/sdvms
6.8 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/OpenSecurity/test/delete-sdvm.bat Fri Dec 06 14:32:35 2013 +0100
7.3 @@ -0,0 +1,2 @@
7.4 +@echo off
7.5 +..\cygwin\bin\curl -X DELETE http://127.0.0.1:8080/sdvms/SecurityDVMTest
7.6 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/OpenSecurity/test/get-credentials.bat Fri Dec 06 14:32:35 2013 +0100
8.3 @@ -0,0 +1,2 @@
8.4 +@echo off
8.5 +..\cygwin\bin\curl --get --data-urlencode "text=User und Password um die Atomraketen abzufeuern:" http://127.0.0.1:8090/credentials
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/OpenSecurity/test/get-password.bat Fri Dec 06 14:32:35 2013 +0100
9.3 @@ -0,0 +1,2 @@
9.4 +@echo off
9.5 +..\cygwin\bin\curl --get --data-urlencode "text=Bitte geben Sie hier das Administrator Passwort ein:" http://127.0.0.1:8090/password
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/OpenSecurity/test/get-sdvm.bat Fri Dec 06 14:32:35 2013 +0100
10.3 @@ -0,0 +1,2 @@
10.4 +@echo off
10.5 +..\cygwin\bin\curl --get http://127.0.0.1:8080/sdvms/SecurityDVMTest
10.6 \ No newline at end of file
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/OpenSecurity/test/get-vm.bat Fri Dec 06 14:32:35 2013 +0100
11.3 @@ -0,0 +1,2 @@
11.4 +@echo off
11.5 +..\cygwin\bin\curl --get http://127.0.0.1:8080/vms/OsecVM
11.6 \ No newline at end of file
12.1 --- a/OpenSecurity/test/list-security-vms.bat Fri Dec 06 14:29:09 2013 +0100
12.2 +++ b/OpenSecurity/test/list-security-vms.bat Fri Dec 06 14:32:35 2013 +0100
12.3 @@ -1,2 +1,2 @@
12.4 @echo off
12.5 -..\cygwin\bin\curl -X GET http://127.0.0.1:8080/sdvms
12.6 \ No newline at end of file
12.7 +..\cygwin\bin\curl --get http://127.0.0.1:8080/sdvms
12.8 \ No newline at end of file
13.1 --- a/OpenSecurity/test/list-single-vm.bat Fri Dec 06 14:29:09 2013 +0100
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,2 +0,0 @@
13.4 -@echo off
13.5 -..\cygwin\bin\curl -X GET http://127.0.0.1:8080/vms/OsecVM
13.6 \ No newline at end of file
14.1 --- a/OpenSecurity/test/list-vms.bat Fri Dec 06 14:29:09 2013 +0100
14.2 +++ b/OpenSecurity/test/list-vms.bat Fri Dec 06 14:32:35 2013 +0100
14.3 @@ -1,2 +1,2 @@
14.4 @echo off
14.5 -..\cygwin\bin\curl -X GET http://127.0.0.1:8080/vms
14.6 \ No newline at end of file
14.7 +..\cygwin\bin\curl --get http://127.0.0.1:8080/vms
14.8 \ No newline at end of file