define the STIXExtension Object

pull/1/head
Emmanuelle Vargas-Gonzalez 2020-10-19 22:08:51 -04:00
parent 97dfe092f9
commit 1bc11ce442
1 changed files with 44 additions and 3 deletions

View File

@ -7,9 +7,10 @@ from ..exceptions import InvalidValueError
from ..markings import _MarkingsMixin from ..markings import _MarkingsMixin
from ..markings.utils import check_tlp_marking from ..markings.utils import check_tlp_marking
from ..properties import ( from ..properties import (
BooleanProperty, DictionaryProperty, HashesProperty, IDProperty, BooleanProperty, DictionaryProperty, EnumProperty, ExtensionsProperty,
IntegerProperty, ListProperty, Property, ReferenceProperty, HashesProperty, IDProperty, IntegerProperty, ListProperty, Property,
SelectorProperty, StringProperty, TimestampProperty, TypeProperty, ReferenceProperty, SelectorProperty, StringProperty, TimestampProperty,
TypeProperty,
) )
from ..utils import NOW, _get_dict from ..utils import NOW, _get_dict
from .base import _STIXBase21 from .base import _STIXBase21
@ -100,6 +101,46 @@ class LanguageContent(_STIXBase21):
('external_references', ListProperty(ExternalReference)), ('external_references', ListProperty(ExternalReference)),
('object_marking_refs', ListProperty(ReferenceProperty(valid_types='marking-definition', spec_version='2.1'))), ('object_marking_refs', ListProperty(ReferenceProperty(valid_types='marking-definition', spec_version='2.1'))),
('granular_markings', ListProperty(GranularMarking)), ('granular_markings', ListProperty(GranularMarking)),
('extensions', ExtensionsProperty(spec_version='2.1', enclosing_type=_type)),
])
class STIXExtension(_STIXBase21):
"""For more detailed information on this object's properties, see
`the STIX 2.1 specification <link here>`__.
"""
_type = 'stix-extension'
_properties = OrderedDict([
('type', TypeProperty(_type, spec_version='2.1')),
('spec_version', StringProperty(fixed='2.1')),
('id', IDProperty(_type, spec_version='2.1')),
('created_by_ref', ReferenceProperty(valid_types='identity', spec_version='2.1', required=True)),
('created', TimestampProperty(default=lambda: NOW, precision='millisecond', precision_constraint='min')),
('modified', TimestampProperty(default=lambda: NOW, precision='millisecond', precision_constraint='min')),
('name', StringProperty(required=True)),
('description', StringProperty()),
('schema', StringProperty(required=True)),
('version', StringProperty(required=True)),
(
'extension_types', ListProperty(
EnumProperty(
allowed=[
'new-sdo',
'new-sco',
'new-sro',
'property-extension',
'toplevel-property-extension',
],
), required=True,
),
),
('extension_properties', ListProperty(StringProperty)),
('revoked', BooleanProperty(default=lambda: False)),
('labels', ListProperty(StringProperty)),
('external_references', ListProperty(ExternalReference)),
('object_marking_refs', ListProperty(ReferenceProperty(valid_types='marking-definition', spec_version='2.1'))),
('granular_markings', ListProperty(GranularMarking)),
]) ])