1.1 --- a/OpenSecurity/bin/opensecurityd.pyw Tue Mar 25 14:25:34 2014 +0100
1.2 +++ b/OpenSecurity/bin/opensecurityd.pyw Tue Apr 01 16:11:36 2014 +0200
1.3 @@ -58,6 +58,7 @@
1.4 '/browsing', 'os_browsing', # http://localhost:8080/browsing GET
1.5 '/fetch_initial_image', 'os_fetch_image', # http://localhost:8080/fetch_initial_image GET
1.6 '/init', 'os_init', # http://localhost:8080/init GET
1.7 + '/initial_image', 'os_initial_image', # http://localhost:8080/initial_image GET
1.8 '/sdvms', 'os_sdvms', # http://localhost:8080/sdvms GET, PUT
1.9 '/sdvms/(.*)/application/(.*)', 'os_sdvm_application', # http://localhost:8080/sdvms/[VMNAME]/application/[COMMAND] GET
1.10 '/sdvms/(.*)/ip', 'os_sdvm_ip', # http://localhost:8080/sdvms/[VMNAME]/ip GET
1.11 @@ -164,6 +165,27 @@
1.12 return page.format(trace_file_name)
1.13
1.14
1.15 +class os_initial_image:
1.16 + """OpenSecurity '/initial_image' handler
1.17 +
1.18 + - GET: Return what we have as initial image.
1.19 + """
1.20 +
1.21 + def GET(self):
1.22 + log_call(web.ctx.environ)
1.23 + global gvm_mgr
1.24 + t = os.path.join(gvm_mgr.systemProperties['Default machine folder'], 'OsecVM.ova')
1.25 + res = ''
1.26 + if os.path.isfile(t):
1.27 + res = '{"initial_template": { '
1.28 + res += '"name": "OsecVM.ova", '
1.29 + res += '"path": "' + t.replace('\\', '\\\\') + '", '
1.30 + res += '"size": ' + str(os.path.getsize(t)) + ', '
1.31 + res += '"date": ' + str(os.path.getmtime(t)) + ''
1.32 + res += '}'
1.33 + return res
1.34 +
1.35 +
1.36 class os_root:
1.37 """OpenSecurity '/' handler
1.38
1.39 @@ -173,11 +195,11 @@
1.40 def GET(self):
1.41 log_call(web.ctx.environ)
1.42 global gvm_mgr
1.43 - res = "'os_server': { "
1.44 - res += "'version': '" + __version__ + "', "
1.45 - res += "'virtual box systemproperties': '" + str(gvm_mgr.systemProperties) + "', "
1.46 - res += "'current temporary folder': '" + tempfile.gettempdir() + "' "
1.47 - res += "}"
1.48 + res = '{"os_server": { '
1.49 + res += '"version": "' + __version__ + '", '
1.50 + res += '"virtual box systemproperties": ' + str(gvm_mgr.systemProperties).replace("'", '"') + ', '
1.51 + res += '"current temporary folder": "' + tempfile.gettempdir().replace('\\', '\\\\') + '" '
1.52 + res += '}}'
1.53 return res
1.54
1.55