OpenSecurity/bin/opensecurity_server.py
author om
Tue, 10 Dec 2013 12:16:11 +0100
changeset 30 0d5637405430
parent 16 e16d64b5e008
permissions -rwxr-xr-x
extended opensecurityd and added some test scripts
     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': 'SecurityDVMBrowser', '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': 'SecurityDVMBrowser', 'ip': '192.168.56.101'}, 
    57     ]
    58     
    59     return vms
    60 
    61     
    62 # start
    63 if __name__ == "__main__":
    64     print("known apps: ")
    65     PrettyPrinter().pprint(query_apps())
    66     print("known vms: ")
    67     PrettyPrinter().pprint(query_vms())
    68     
    69