cti-python-stix2/stix2/common.py

34 lines
1.1 KiB
Python
Raw Normal View History

2017-02-10 22:35:02 +01:00
"""STIX 2 Common Data Types and Properties"""
from .base import _STIXBase
2017-04-11 21:05:22 +02:00
from .properties import (Property, ListProperty, StringProperty, BooleanProperty,
ReferenceProperty, TimestampProperty)
2017-02-10 22:35:02 +01:00
from .utils import NOW
COMMON_PROPERTIES = {
# 'type' and 'id' should be defined on each individual type
2017-04-11 18:10:55 +02:00
'created': TimestampProperty(default=lambda: NOW),
'modified': TimestampProperty(default=lambda: NOW),
'external_references': Property(),
'revoked': BooleanProperty(),
'created_by_ref': ReferenceProperty(type="identity"),
'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")),
'granular_markings': ListProperty(Property)
2017-02-10 22:35:02 +01:00
}
class ExternalReference(_STIXBase):
_properties = {
'source_name': StringProperty(required=True),
'description': StringProperty(),
'url': StringProperty(),
'external_id': StringProperty(),
2017-02-10 22:35:02 +01:00
}
class KillChainPhase(_STIXBase):
_properties = {
2017-04-07 23:34:06 +02:00
'kill_chain_name': StringProperty(required=True),
'phase_name': StringProperty(required=True),
}