maec Module

Version: 4.1.0.17


Classes

class maec.Entity[source]

Bases: mixbox.entities.Entity

Base class for all classes in the MAEC SimpleAPI.

to_xml_file(file, namespace_dict=None, custom_header=None)[source]

Export an object to an XML file. Only supports Package or Bundle objects at the moment.

Parameters:
  • file – the name of a file or a file-like object to write the output to.
  • namespace_dict – a dictionary of mappings of additional XML namespaces to prefixes.
  • custom_header – a string, list, or dictionary that represents a custom XML header to be written to the output.
class maec.EntityList(*args)[source]

Bases: collections.abc.MutableSequence, mixbox.entities.Entity

An EntityList is an Entity that behaves like a mutable sequence.

EntityList implementations must define one multiple TypedField which has an Entity subclass type. EntityLists can define other TypedFields that are not multiple.

The MutableSequence methods are used to interact with the multiple TypedField.

insert(idx, value)[source]

S.insert(index, value) – insert value before index

classmethod list_from_object(entitylist_obj)[source]

Convert from object representation to list representation.

classmethod object_from_list(entitylist_list)[source]

Convert from list representation to object representation.

to_dict()[source]

Convert to a dict

Subclasses can override this function.

Returns:Python dict with keys set from this Entity.