MSV FM

[email protected]: ~ $
Path : /lib/fm-agent/library/
File Upload :
Current < : //lib/fm-agent/library/forticlient_helper.py

import json
import logging
from os import path

class ForticlientHelper:
    data_path = '/Library/Application Support/Fortinet/FortiClient/data/'
    vpn_data = '/Library/Application Support/Fortinet/FortiClient/conf/vpn.plist'
    def __init__(self):
        #
        # Map file containing data to aggregator handhake key
        #
        self.data_files_map = {
            'fct_uid.conf' : 'forticlient_serial',
            'EMS_sn.conf' : 'ems_serial'
        }
        self.log = logging.getLogger()

    def parse_address(self, url):
        try:
            import urllib.parse as urlparse
            parsed = urlparse.urlparse(url)
            if parsed.scheme == '':
                parsed = urlparse.urlparse("http://" + url)
            host = parsed.netloc
            try:
                idx = host.index(':')
                host = host[0:idx]
            except:
                pass
            host_parts = host.lower().split('.')
            if len(host_parts) < 4:
                return None
            if host_parts[-1] == 'com' and host_parts[-2] == 'fortisase' and host_parts[-4] == 'edge':
                return host_parts[-3]
            return None
        except:
            return None

    """
    To determine the environment for FortiSASE, we expect
    to find a server address of the form:
    <name0>.edge.<environment>.fortisase.com
    where name0 is arbitrary, and environment is what
    we will pass to the aggregator.
    """
    def get_vpn_environment(self):
        import plistlib
        with open(self.vpn_data, 'rb') as f:
            data = plistlib.load(f)
            for profileInfo in data['Profiles'].values():
                server_name = profileInfo.get('Server', None)
                if server_name:
                    env = self.parse_address(server_name)
                    if env:
                        return env

        raise Exception('No environment profile found')

    def get_handshake_data(self):
        if not path.isdir(self.data_path):
            raise Exception('Missing forticlient data')
        
        rv = {}
        key_count = 0
        for file, hs_key in self.data_files_map.items():
            key_count += 1
            with open(path.join(self.data_path, file), 'r') as df:
                dv = df.readline().strip()
                if len(dv) > 0:
                    rv[hs_key] = dv

        if len(rv.keys()) != key_count:
            raise Exception('Missing forticlient keys')
        try:
            rv['forticlient_environment'] = self.get_vpn_environment()
        except:
            raise Exception('Missing VPN data')

        return rv
Bethany
Bethany
0%

THE FINEST HOTEL NEAR LAKE KIVU

The Perfect Base For You

Required fields are followed by *





EC1A68011

About Us

Delicious Interior With The Pinch Of Everything

Bethany Investment group is Presbyterian church in Rwanda(EPR) company that manage Hotel and Guest house in Karongi (Bethany Hotel), ISANO branch in GIKONDO(Kigali), Kiyovu branch(Kigali), AMIZERO branch(Nyagatare-East) and Gisenyi Branch(Rubavu).

Accomodation

Get a Comfortable Room
Feel The Comfort

Get a comfortable room and feel our hotel’s comfort. Bethany Hotel features a variety of fully furnished rooms with extra space, Executive rooms, Deluxe rooms with a beautiful lake view and garden space, Deluxe rooms, comfort rooms, family rooms and standard rooms at your service.

Standard Single

Services

We Provide Top Class Facility
Especially For You

Beach BBQ Party

Kick back on the beach& and enjoy our berbecue from our masterchef

Breakfast

Kick back at our hotels& enjoy our breakfast from our masterchef

Conference Hall

Kick back at our hotels& enjoy our conference halls from all bethany branches

Enjoy with your partner

Honeymoon Package

80%

Get In Touch

Don’t Miss Any Update

    +

    Search your Room

    Required fields are followed by *