OpenSecurity/bin/opensecurity_server.py
author om
Fri, 06 Dec 2013 10:51:15 +0100
changeset 13 4457d7071a23
child 16 e16d64b5e008
permissions -rw-r--r--
adopted server code and merged client into "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': '', 'name': 'Browser', 'command': '/usr/bin/iceweasel'}, 
    46     ]
    47     
    48     return apps
    49     
    50 
    51 def query_vms():
    52     """get the list of registered vms, their ip and the prefered user"""
    53     
    54     # TODO: REPLACE THIS HARDCODED STUFF WITH REAL CODE TO THE OS SERVER
    55     vms = [ 
    56         { 'user': 'opensec', 'name': 'Debian 7', 'ip': '192.168.56.101'}, 
    57         { 'user': 'opensec', 'name': 'Anit-Virus VM', 'ip': '192.168.56.101'}
    58     ]
    59     
    60     return vms
    61 
    62     
    63 # start
    64 if __name__ == "__main__":
    65     print("known apps: ")
    66     PrettyPrinter().pprint(query_apps())
    67     print("known vms: ")
    68     PrettyPrinter().pprint(query_vms())
    69     
    70