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