CybOXProject / python-cybox

A Python library for parsing, manipulating, and generating CybOX content.
http://cybox.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
77 stars 42 forks source link

Parsing fails if algorithm, compression_mechanism, or encryption_mechanism are not present #326

Closed emmanvg closed 4 years ago

emmanvg commented 4 years ago

For Encoding, Encryption and Compression API classes we have a Factory that currently is limited in its extensibility. If the class is not found in the if/else clause it will fail hard. Propose a way to register new API classes, as a fallback it will create the an instance of the default class. Yet, keep in mind that trying to access the Articfact.packed_data or Artifact.data properties may return in a NotImplementedError because pack() and unpack() methods are not defined for base classes.

This fix would allow to interact with the parsed object even if a valid API class is not available.