colander_data_converter.formats.stix2.models module

class colander_data_converter.formats.stix2.models.Stix2Converter[source]

Bases: object

Converter for STIX2 data to Colander data and vice versa. Uses the mapping file to convert between formats.

static colander_to_stix2(colander_feed)[source]

Converts Colander data to STIX2 data using the mapping file.

Parameters:

colander_feed (ColanderFeed) – The Colander data to convert.

Returns:

The converted STIX2 data.

Return type:

Dict[str, Any]

static stix2_to_colander(stix2_data)[source]

Converts STIX2 data to Colander data using the mapping file.

Parameters:

stix2_data (Dict[str, Any]) – The STIX2 data to convert.

Returns:

The converted Colander data.

Return type:

ColanderFeed

class colander_data_converter.formats.stix2.models.Stix2Repository(*args, **kwargs)[source]

Bases: object

Singleton repository for managing and storing STIX2 objects.

This class provides centralized storage and reference management for all STIX2 objects, supporting conversion to and from Colander data.

add_object(stix2_object)[source]

Adds a STIX2 object to the repository.

Parameters:

stix2_object (Dict[str, Any]) – The STIX2 object to add.

clear()[source]

Clears all STIX2 objects from the repository.

get_object(object_id)[source]

Retrieves a STIX2 object from the repository by its ID.

Parameters:

object_id (str) – The ID of the STIX2 object to retrieve.

Returns:

The STIX2 object if found, None otherwise.

Return type:

Optional[Dict[str, Any]]

stix2_objects: Dict[str, Dict[str, Any]]