# HG changeset patch # User om # Date 1386331311 -3600 # Node ID 85571680438a17d1beeab591dae810cd7ae67959 # Parent 3111f077646dfd3171af6b8ccf2c701d8052f35d deleted superfluous files diff -r 3111f077646d -r 85571680438a OpenSecurity/server/opensecurityd.py --- a/OpenSecurity/server/opensecurityd.py Fri Dec 06 12:52:34 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -#!/bin/env python -# -*- coding: utf-8 -*- - -# ------------------------------------------------------------ -# opensecurityd -# -# the opensecurityd as RESTful server -# -# Autor: Oliver Maurhart, -# -# Copyright (C) 2013 AIT Austrian Institute of Technology -# AIT Austrian Institute of Technology GmbH -# Donau-City-Strasse 1 | 1220 Vienna | Austria -# http://www.ait.ac.at -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation version 2. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# ------------------------------------------------------------ - - -# ------------------------------------------------------------ -# imports - -import os -import os.path -import subprocess -import sys -import web - -# local -from environment import Environment - - -# ------------------------------------------------------------ -# const - - -__version__ = "0.1" - - -"""All the URLs we know mapping to class handler""" -opensecurity_urls = ( - '/application', 'os_application', - '/device', 'os_device', - '/device/credentials', 'os_device_credentials', - '/device/password', 'os_device_password', - '/', 'os_root' -) - - -# ------------------------------------------------------------ -# code - - -class os_application: - - """OpenSecurity '/application' handler. - - This is called on GET /application?vm=VM-ID&app=APP-ID - This tries to access the vm identified with the label VM-ID - and launched the application identified APP-ID - """ - - def GET(self): - - # pick the arguments - args = web.input() - - # we _need_ a vm - if not "vm" in args: - raise web.badrequest() - - # we _need_ a app - if not "app" in args: - raise web.badrequest() - - ## TODO: HARD CODED STUFF HERE! THIS SHOULD BE FLEXIBLE! - ssh_private_key = os.path.join(Environment("opensecurity").data_path, 'share', '192.168.56.15.ppk') - putty_session = '192.168.56.15' - process_command = ['plink.exe', '-i', ssh_private_key, putty_session, args.app] - si = subprocess.STARTUPINFO() - si.dwFlags = subprocess.STARTF_USESHOWWINDOW - si.wShowWindow = subprocess.SW_HIDE - print('tyring to launch: ' + ' '.join(process_command)) - process = subprocess.Popen(process_command, shell = True) - return 'launched: ' + ' '.join(process_command) - - -class os_device: - - """OpenSecurity '/device' handler""" - - def GET(self): - return "os_device" - - -class os_device_credentials: - - """OpenSecurity '/device/credentials' handler. - - This is called on GET /device/credentials?id=DEVICE-ID. - Ideally this should pop up a user dialog to insert his - credentials based the DEVICE-ID - """ - - def GET(self): - - # pick the arguments - args = web.input() - - # we _need_ a device id - if not "id" in args: - raise web.badrequest() - - # invoke the user dialog as a subprocess - dlg_credentials_image = os.path.join(sys.path[0], 'opensecurity-dialog.py') - process_command = [sys.executable, dlg_credentials_image, 'credentials', 'Please provide credentials for accessing \ndevice: "{0}".'.format(args.id)] - process = subprocess.Popen(process_command, shell = False, stdout = subprocess.PIPE) - result = process.communicate()[0] - if process.returncode != 0: - return 'Credentials request has been aborted.' - - return result - - -class os_device_password: - - """OpenSecurity '/device/password' handler. - - This is called on GET /device/password?id=DEVICE-ID. - Ideally this should pop up a user dialog to insert his - password based the DEVICE-ID - """ - - def GET(self): - - # pick the arguments - args = web.input() - - # we _need_ a device id - if not "id" in args: - raise web.badrequest() - - # invoke the user dialog as a subprocess - dlg_credentials_image = os.path.join(sys.path[0], 'opensecurity-dialog.py') - process_command = [sys.executable, dlg_credentials_image, 'password', 'Please provide a password for accessing \ndevice: "{0}".'.format(args.id)] - process = subprocess.Popen(process_command, shell = False, stdout = subprocess.PIPE) - result = process.communicate()[0] - if process.returncode != 0: - return 'Credentials request has been aborted.' - - return result - - -class os_root: - - """OpenSecurity '/' handler""" - - def GET(self): - return "OpenSecurity-Server { \"version\": \"%s\" }" % __version__ - - -# start -if __name__ == "__main__": - server = web.application(opensecurity_urls, globals()) - server.run() - diff -r 3111f077646d -r 85571680438a server/vmmanager/PKG-INFO --- a/server/vmmanager/PKG-INFO Fri Dec 06 12:52:34 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: vmmanager.py -Version: 0.1 -Summary: vmmanager.py: manages GustVM's -Home-page: http://webpy.org/ -Author: Mihai Bartha -Author-email: mihai.bartha@ait.ac.at -License: Public domain -Description: Module to manage virtualbox guests and host -Platform: any diff -r 3111f077646d -r 85571680438a server/vmmanager/__init__.py --- a/server/vmmanager/__init__.py Fri Dec 06 12:52:34 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -__version__ = "0.1" -__author__ = [ - "Mihai Bartha " -] -__license__ = "public domain" -__contributors__ = "OpenSecurity Consortium" \ No newline at end of file diff -r 3111f077646d -r 85571680438a server/vmmanager/__init__.pyc Binary file server/vmmanager/__init__.pyc has changed diff -r 3111f077646d -r 85571680438a server/vmmanager/vmmanager.pyc Binary file server/vmmanager/vmmanager.pyc has changed