maec_to_stix.indicator_extractor.config_parser Module

class maec_to_stix.indicator_extractor.config_parser.ConfigParser(config_directory=None)

Bases: object

Used to parse the JSON indicator extraction configuration files.

config_dict

the parsed dictionary representation of the main configuration file.

supported_actions

the list of supported Actions (names).

supported_objects

a dictionary of supported Objects and their properties.

Parameters:config_directory – the path to the directory where the configuration files can be found.
static flatten_dict(d, parent_key='', sep='/')

Flatten a nested dictionary into one with a single set of key/value pairs.

Parameters:
  • d – an input dictionary to flatten.
  • parent_key – the parent_key, for use in building the root key name when handling nested dictionaries.
  • sep – the separator to use between the concatenated keys in the root key.
Returns:

The flattened representation of the input dictionary.

parse_config()

Parse the JSON configuration structure and build the appropriate data structures.

print_config()

Print the current set of configuration parameters to stdout.

Note

This method prints detailed information about the parsed Indicator extraction configuration, including:

  1. The general Indicator extraction parameters (from config/extractor_config.json)
  2. The supported Actions (derived from all of the parsed JSON configuration files)
  3. The supported Objects and their properties (derived from all of the parsed JSON configuration files)
  4. The contra-indicators and modifiers to use in candidate Object filtering