cti-python-stix2/stix2/common.py

23 lines
942 B
Python
Raw Normal View History

2017-02-10 22:35:02 +01:00
"""STIX 2 Common Data Types and Properties"""
from collections import OrderedDict
from .other import ExternalReference, GranularMarking
from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
StringProperty, TimestampProperty)
2017-02-10 22:35:02 +01:00
from .utils import NOW
COMMON_PROPERTIES = OrderedDict()
COMMON_PROPERTIES.update([
# 'type' and 'id' should be defined on each individual type
('created_by_ref', ReferenceProperty(type="identity")),
('created', TimestampProperty(default=lambda: NOW, precision='millisecond')),
('modified', TimestampProperty(default=lambda: NOW, precision='millisecond')),
('revoked', BooleanProperty()),
('labels', ListProperty(StringProperty)),
('external_references', ListProperty(ExternalReference)),
('object_marking_refs', ListProperty(ReferenceProperty(type="marking-definition"))),
('granular_markings', ListProperty(GranularMarking)),
])