def __init__(self):
    config_file_path = (os.path.dirname(os.path.abspath(__file__)) + '/../config.yml')
    config = (yaml.load(open(config_file_path), Loader=yaml.SafeLoader) if os.path.isfile(config_file_path) else {})
    self.confidence_level = get_config_variable('CONNECTOR_CONFIDENCE_LEVEL', ['connector', 'confidence_level'], config, isNumber=True)
    self.update_existing_data = get_config_variable('CONNECTOR_UPDATE_EXISTING_DATA', ['connector', 'update_existing_data'], config)
    self.API_KEY = get_config_variable('VALHALLA_API_KEY', ['valhalla', 'api_key'], config)
    self.INTERVAL_SEC = get_config_variable('VALHALLA_INTERVAL_SEC', ['valhalla', 'interval_sec'], config, isNumber=True)
    self.helper = OpenCTIConnectorHelper(config)
    self.helper.log_info(f'loaded valhalla config: {config}')
    if ((self.API_KEY == '') or (self.API_KEY is None)):
        self.default_marking = self.helper.api.marking_definition.read(id=TLP_WHITE['id'])
        self.valhalla_client = ValhallaAPI()
    else:
        self.default_marking = self.helper.api.marking_definition.read(id=TLP_AMBER['id'])
        self.valhalla_client = ValhallaAPI(api_key=self.API_KEY)
    self.knowledge_importer = KnowledgeImporter(self.helper, self.confidence_level, self.update_existing_data, self.default_marking, self.valhalla_client)
def __init__(self):
    config_file_path = (os.path.dirname(os.path.abspath(__file__)) + '/../config.yml')
    config = (yaml.load(open(config_file_path), Loader=yaml.SafeLoader) if os.path.isfile(config_file_path) else {})
    self.confidence_level = get_config_variable('CONNECTOR_CONFIDENCE_LEVEL', ['connector', 'confidence_level'], config, isNumber=True)
    self.update_existing_data = get_config_variable('CONNECTOR_UPDATE_EXISTING_DATA', ['connector', 'update_existing_data'], config)
    self.API_KEY = get_config_variable('VALHALLA_API_KEY', ['valhalla', 'api_key'], config)
    self.INTERVAL_SEC = get_config_variable('VALHALLA_INTERVAL_SEC', ['valhalla', 'interval_sec'], config, isNumber=True)
    self.helper = OpenCTIConnectorHelper(config)
    self.helper.log_info(f'loaded valhalla config: {config}')
    if ((self.API_KEY == ) or (self.API_KEY is None)):
        self.default_marking = self.helper.api.marking_definition.read(id=TLP_WHITE['id'])
        self.valhalla_client = ValhallaAPI()
    else:
        self.default_marking = self.helper.api.marking_definition.read(id=TLP_AMBER['id'])
        self.valhalla_client = ValhallaAPI(api_key=self.API_KEY)
    self.knowledge_importer = KnowledgeImporter(self.helper, self.confidence_level, self.update_existing_data, self.default_marking, self.valhalla_client)