colander_data_converter.converters.stix2.converter

class colander_data_converter.converters.stix2.converter.ColanderToStix2Mapper[source]

Bases: Stix2Mapper

Maps Colander data to STIX2 data using the mapping file.

convert(colander_feed)[source]
Return type:

Stix2Bundle

convert_colander_entity(entity)[source]

Convert a Colander entity to a STIX2 object.

Parameters:

entity (Actor | Device | Artifact | Observable | Threat) – The Colander entity to convert.

Returns:

The converted STIX2 object, or None if the entity type is not supported.

Return type:

Optional[Dict[str, Any]]

convert_colander_relation(relation)[source]

Convert a Colander EntityRelation to a STIX2 relationship object.

Parameters:

relation (EntityRelation) – The Colander EntityRelation to convert.

Returns:

The converted STIX2 relationship object, or None if the relation cannot be

converted.

Return type:

Optional[Dict[str, Any]]

class colander_data_converter.converters.stix2.converter.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 (colander_data_converter.base.models.ColanderFeed) – The Colander data to convert.

Returns:

The converted STIX2 bundle.

Return type:

Stix2Bundle

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.converters.stix2.converter.Stix2Mapper[source]

Bases: object

Base class for mapping between STIX2 and Colander data using the mapping file.

__init__()[source]

Initialize the mapper.

class colander_data_converter.converters.stix2.converter.Stix2ToColanderMapper[source]

Bases: Stix2Mapper

Maps STIX2 data to Colander data using the mapping file.

convert(stix2_data)[source]

Convert STIX2 data to Colander data.

Parameters:

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

Returns:

The converted Colander data.

Return type:

ColanderFeed

convert_stix2_object(stix2_object)[source]

Convert a STIX2 object to a Colander entity.

Parameters:

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

Returns:

The converted Colander entity, or None if the object type is not supported.

Return type:

Optional[Union[Actor, Device, Artifact, Observable, Threat, Event, DetectionRule, DataFragment, EntityRelation]]