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