Implement LanguageContent object. Update GranularMarking and other missing properties
parent
b99d9e4132
commit
c4c2fb950e
|
@ -4,9 +4,10 @@ from collections import OrderedDict
|
||||||
|
|
||||||
from .base import _STIXBase
|
from .base import _STIXBase
|
||||||
from .markings import _MarkingsMixin
|
from .markings import _MarkingsMixin
|
||||||
from .properties import (HashesProperty, IDProperty, ListProperty, Property,
|
from .properties import (BooleanProperty, DictionaryProperty, HashesProperty,
|
||||||
ReferenceProperty, SelectorProperty, StringProperty,
|
IDProperty, ListProperty, Property, ReferenceProperty,
|
||||||
TimestampProperty, TypeProperty)
|
SelectorProperty, StringProperty, TimestampProperty,
|
||||||
|
TypeProperty)
|
||||||
from .utils import NOW, get_dict
|
from .utils import NOW, get_dict
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +40,37 @@ class GranularMarking(_STIXBase):
|
||||||
|
|
||||||
_properties = OrderedDict()
|
_properties = OrderedDict()
|
||||||
_properties.update([
|
_properties.update([
|
||||||
('marking_ref', ReferenceProperty(required=True, type="marking-definition")),
|
('lang', StringProperty()),
|
||||||
|
('marking_ref', ReferenceProperty(type="marking-definition")), # TODO: In 2.0 is required, not in 2.1
|
||||||
('selectors', ListProperty(SelectorProperty, required=True)),
|
('selectors', ListProperty(SelectorProperty, required=True)),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def _check_object_constraints(self):
|
||||||
|
super(GranularMarking, self)._check_object_constraints()
|
||||||
|
self._check_at_least_one_property(["lang", "marking_ref"])
|
||||||
|
|
||||||
|
|
||||||
|
class LanguageContent(_STIXBase):
|
||||||
|
_type = 'language-content'
|
||||||
|
_properties = OrderedDict()
|
||||||
|
_properties.update([
|
||||||
|
('type', TypeProperty(_type)),
|
||||||
|
('id', IDProperty(_type)),
|
||||||
|
('created_by_ref', ReferenceProperty(type="identity")),
|
||||||
|
('created', TimestampProperty(default=lambda: NOW, precision='millisecond')),
|
||||||
|
('modified', TimestampProperty(default=lambda: NOW, precision='millisecond')),
|
||||||
|
('object_ref', ReferenceProperty(required=True)),
|
||||||
|
# TODO: 'object_modified' it MUST be an exact match for the modified time of the STIX Object (SRO or SDO) being referenced.
|
||||||
|
('object_modified', TimestampProperty(required=True)),
|
||||||
|
# TODO: 'contents' https://docs.google.com/document/d/1ShNq4c3e1CkfANmD9O--mdZ5H0O_GLnjN28a_yrEaco/edit#heading=h.cfz5hcantmvx
|
||||||
|
('contents', DictionaryProperty(required=True)),
|
||||||
|
('revoked', BooleanProperty()),
|
||||||
|
('labels', ListProperty(StringProperty)),
|
||||||
|
('external_references', ListProperty(ExternalReference)),
|
||||||
|
('object_marking_refs', ListProperty(ReferenceProperty(type="marking-definition"))),
|
||||||
|
('granular_markings', ListProperty(GranularMarking)),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
class TLPMarking(_STIXBase):
|
class TLPMarking(_STIXBase):
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ class AutonomousSystem(_Observable):
|
||||||
_properties = OrderedDict()
|
_properties = OrderedDict()
|
||||||
_properties.update([
|
_properties.update([
|
||||||
('type', TypeProperty(_type)),
|
('type', TypeProperty(_type)),
|
||||||
('number', IntegerProperty()),
|
('number', IntegerProperty(required=True)),
|
||||||
('name', StringProperty()),
|
('name', StringProperty()),
|
||||||
('rir', StringProperty()),
|
('rir', StringProperty()),
|
||||||
('extensions', ExtensionsProperty(enclosing_type=_type)),
|
('extensions', ExtensionsProperty(enclosing_type=_type)),
|
||||||
|
@ -459,6 +459,8 @@ class SocketExt(_Extension):
|
||||||
"SOCK_RDM",
|
"SOCK_RDM",
|
||||||
"SOCK_SEQPACKET",
|
"SOCK_SEQPACKET",
|
||||||
])),
|
])),
|
||||||
|
('socket_descriptor', IntegerProperty()),
|
||||||
|
('socket_handle', IntegerProperty())
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue