OpenSecurity/bin/opensecurity_server.py
author om
Fri, 06 Dec 2013 12:10:30 +0100
changeset 14 c187aaceca32
parent 3 OpenSecurity/client/opensecurity_server.py@65432e6c6042
child 16 e16d64b5e008
permissions -rwxr-xr-x
renamed "client" to "bin"
     1 #!/bin/env python
     2 # -*- coding: utf-8 -*-
     3 
     4 # ------------------------------------------------------------
     5 # opensecurity-server
     6 # 
     7 # talk to the opensecurity server
     8 #
     9 # Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    10 #
    11 # Copyright (C) 2013 AIT Austrian Institute of Technology
    12 # AIT Austrian Institute of Technology GmbH
    13 # Donau-City-Strasse 1 | 1220 Vienna | Austria
    14 # http://www.ait.ac.at
    15 #
    16 # This program is free software; you can redistribute it and/or
    17 # modify it under the terms of the GNU General Public License
    18 # as published by the Free Software Foundation version 2.
    19 # 
    20 # This program is distributed in the hope that it will be useful,
    21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23 # GNU General Public License for more details.
    24 # 
    25 # You should have received a copy of the GNU General Public License
    26 # along with this program; if not, write to the Free Software
    27 # Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    28 # Boston, MA  02110-1301, USA.
    29 # ------------------------------------------------------------
    30 
    31 # ------------------------------------------------------------
    32 # import
    33 
    34 from pprint import PrettyPrinter
    35 
    36 
    37 # ------------------------------------------------------------
    38 # code
    39 
    40 def query_apps():
    41     """get the list of known apps"""
    42     
    43     # TODO: REPLACE THIS HARDCODED STUFF WITH REAL CODE TO THE OS SERVER
    44     apps = [ 
    45         { 'vm': 'Debian 7', 'name': 'Browser', 'command': '/usr/bin/iceweasel'}, 
    46         { 'vm': 'Debian 7', 'name': 'VLC', 'command': '/usr/bin/vlc'}
    47     ]
    48     
    49     return apps
    50     
    51 
    52 def query_vms():
    53     """get the list of registered vms, their ip and the prefered user"""
    54     
    55     # TODO: REPLACE THIS HARDCODED STUFF WITH REAL CODE TO THE OS SERVER
    56     vms = [ 
    57         { 'user': 'user', 'name': 'Debian 7', 'ip': '192.168.56.101'}, 
    58         { 'user': 'user', 'name': 'Anit-Virus VM', 'ip': '192.168.56.101'}
    59     ]
    60     
    61     return vms
    62 
    63     
    64 # start
    65 if __name__ == "__main__":
    66     print("known apps: ")
    67     PrettyPrinter().pprint(query_apps())
    68     print("known vms: ")
    69     PrettyPrinter().pprint(query_vms())
    70     
    71