OpenSecurity/bin/opensecurity_server.py
changeset 14 c187aaceca32
parent 3 65432e6c6042
child 16 e16d64b5e008
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/OpenSecurity/bin/opensecurity_server.py	Fri Dec 06 12:10:30 2013 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +#!/bin/env python
     1.5 +# -*- coding: utf-8 -*-
     1.6 +
     1.7 +# ------------------------------------------------------------
     1.8 +# opensecurity-server
     1.9 +# 
    1.10 +# talk to the opensecurity server
    1.11 +#
    1.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    1.13 +#
    1.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    1.15 +# AIT Austrian Institute of Technology GmbH
    1.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    1.17 +# http://www.ait.ac.at
    1.18 +#
    1.19 +# This program is free software; you can redistribute it and/or
    1.20 +# modify it under the terms of the GNU General Public License
    1.21 +# as published by the Free Software Foundation version 2.
    1.22 +# 
    1.23 +# This program is distributed in the hope that it will be useful,
    1.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.26 +# GNU General Public License for more details.
    1.27 +# 
    1.28 +# You should have received a copy of the GNU General Public License
    1.29 +# along with this program; if not, write to the Free Software
    1.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    1.31 +# Boston, MA  02110-1301, USA.
    1.32 +# ------------------------------------------------------------
    1.33 +
    1.34 +# ------------------------------------------------------------
    1.35 +# import
    1.36 +
    1.37 +from pprint import PrettyPrinter
    1.38 +
    1.39 +
    1.40 +# ------------------------------------------------------------
    1.41 +# code
    1.42 +
    1.43 +def query_apps():
    1.44 +    """get the list of known apps"""
    1.45 +    
    1.46 +    # TODO: REPLACE THIS HARDCODED STUFF WITH REAL CODE TO THE OS SERVER
    1.47 +    apps = [ 
    1.48 +        { 'vm': 'Debian 7', 'name': 'Browser', 'command': '/usr/bin/iceweasel'}, 
    1.49 +        { 'vm': 'Debian 7', 'name': 'VLC', 'command': '/usr/bin/vlc'}
    1.50 +    ]
    1.51 +    
    1.52 +    return apps
    1.53 +    
    1.54 +
    1.55 +def query_vms():
    1.56 +    """get the list of registered vms, their ip and the prefered user"""
    1.57 +    
    1.58 +    # TODO: REPLACE THIS HARDCODED STUFF WITH REAL CODE TO THE OS SERVER
    1.59 +    vms = [ 
    1.60 +        { 'user': 'user', 'name': 'Debian 7', 'ip': '192.168.56.101'}, 
    1.61 +        { 'user': 'user', 'name': 'Anit-Virus VM', 'ip': '192.168.56.101'}
    1.62 +    ]
    1.63 +    
    1.64 +    return vms
    1.65 +
    1.66 +    
    1.67 +# start
    1.68 +if __name__ == "__main__":
    1.69 +    print("known apps: ")
    1.70 +    PrettyPrinter().pprint(query_apps())
    1.71 +    print("known vms: ")
    1.72 +    PrettyPrinter().pprint(query_vms())
    1.73 +    
    1.74 +