add: Applying interoperability parameter to v2.1 objects

master
chrisr3d 2018-12-14 10:12:30 +01:00
parent a68a43a732
commit 939a2d5428
No known key found for this signature in database
GPG Key ID: 6BBED1B63A6D639F
5 changed files with 34 additions and 4 deletions

View File

@ -31,7 +31,12 @@ class Bundle(_STIXBase):
else:
kwargs['objects'] = list(args) + kwargs.get('objects', [])
self.__allow_custom = kwargs.get('allow_custom', False)
self._properties['objects'].contained.allow_custom = kwargs.get('allow_custom', False)
allow_custom = kwargs.get('allow_custom', False)
self.__allow_custom = allow_custom
self._properties['objects'].contained.allow_custom = allow_custom
interoperability = kwargs.get('interoperability', False)
self.__interoperability = interoperability
self._properties['id'].interoperability = interoperability
self._properties['objects'].contained.interoperability = interoperability
super(Bundle, self).__init__(**kwargs)

View File

@ -29,7 +29,12 @@ class Bundle(_STIXBase):
else:
kwargs['objects'] = list(args) + kwargs.get('objects', [])
self.__allow_custom = kwargs.get('allow_custom', False)
self._properties['objects'].contained.allow_custom = kwargs.get('allow_custom', False)
allow_custom = kwargs.get('allow_custom', False)
self.__allow_custom = allow_custom
self._properties['objects'].contained.allow_custom = allow_custom
interoperability = kwargs.get('interoperability', False)
self.__interoperability = interoperability
self._properties['id'].interoperability = interoperability
self._properties['objects'].contained.interoperability = interoperability
super(Bundle, self).__init__(**kwargs)

View File

@ -171,6 +171,12 @@ class MarkingDefinition(_STIXBase, _MarkingsMixin):
if not isinstance(kwargs['definition'], marking_type):
defn = _get_dict(kwargs['definition'])
kwargs['definition'] = marking_type(**defn)
interoperability = kwargs.get('interoperability', False)
self._properties['id'].interoperability = interoperability
if kwargs.get('created_by_ref'):
self._properties['created_by_ref'].interoperability = interoperability
if kwargs.get('object_marking_refs'):
self._properties['object_marking_refs'].contained.interoperability = interoperability
super(MarkingDefinition, self).__init__(**kwargs)

View File

@ -434,6 +434,11 @@ class Report(STIXDomainObject):
('granular_markings', ListProperty(GranularMarking)),
])
def __init__(self, *args, **kwargs):
self._properties['object_refs'].contained.interoperability = kwargs.get('interoperability', False)
super(Report, self).__init__(*args, **kwargs)
class ThreatActor(STIXDomainObject):
# TODO: Add link

View File

@ -52,6 +52,9 @@ class Relationship(STIXRelationshipObject):
kwargs['relationship_type'] = relationship_type
if target_ref and not kwargs.get('target_ref'):
kwargs['target_ref'] = target_ref
interoperability = kwargs.get('interoperability', False)
self._properties['source_ref'].interoperability = interoperability
self._properties['target_ref'].interoperability = interoperability
super(Relationship, self).__init__(**kwargs)
@ -101,6 +104,12 @@ class Sighting(STIXRelationshipObject):
# Allow sighting_of_ref as a positional arg.
if sighting_of_ref and not kwargs.get('sighting_of_ref'):
kwargs['sighting_of_ref'] = sighting_of_ref
interoperability = kwargs.get('interoperability', False)
self._properties['sighting_of_ref'].interoperability = interoperability
if kwargs.get('observed_data_refs'):
self._properties['observed_data_refs'].contained.interoperability = interoperability
if kwargs.get('where_sighted_refs'):
self._properties['where_sighted_refs'].contained.interoperability = interoperability
super(Sighting, self).__init__(**kwargs)