From ddfdd59d6fdcb6f31cfd5bdbdc118269ac4326a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Lima?= Date: Wed, 18 Oct 2023 20:50:09 +0000 Subject: [PATCH 1/4] Rename AlternateDataStream based on the naming pattern and add missing _type --- stix2/v21/observables.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stix2/v21/observables.py b/stix2/v21/observables.py index f4a4be0f..29cddcf8 100644 --- a/stix2/v21/observables.py +++ b/stix2/v21/observables.py @@ -212,11 +212,12 @@ class ArchiveExt(_Extension): ]) -class AlternateDataStream(_STIXBase21): +class AlternateDataStreamType(_STIXBase21): """For more detailed information on this object's properties, see `the STIX 2.1 specification `__. """ + _type = 'alternate-data-stream-type' _properties = OrderedDict([ ('name', StringProperty(required=True)), ('hashes', HashesProperty(HASHING_ALGORITHM, spec_version="2.1")), @@ -232,7 +233,7 @@ class NTFSExt(_Extension): _type = 'ntfs-ext' _properties = OrderedDict([ ('sid', StringProperty()), - ('alternate_data_streams', ListProperty(EmbeddedObjectProperty(type=AlternateDataStream))), + ('alternate_data_streams', ListProperty(EmbeddedObjectProperty(type=AlternateDataStreamType))), ]) From 5f713268719531371d3644917cac4689f946cafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Lima?= Date: Wed, 18 Oct 2023 20:47:10 +0000 Subject: [PATCH 2/4] Add missing _type to _WindowsPEOptionalHeaderType --- stix2/v21/observables.py | 1 + 1 file changed, 1 insertion(+) diff --git a/stix2/v21/observables.py b/stix2/v21/observables.py index 29cddcf8..23ad8328 100644 --- a/stix2/v21/observables.py +++ b/stix2/v21/observables.py @@ -271,6 +271,7 @@ class WindowsPEOptionalHeaderType(_STIXBase21): `the STIX 2.1 specification `__. """ + _type = 'windows-pe-optional-header-type' _properties = OrderedDict([ ('magic_hex', HexProperty()), ('major_linker_version', IntegerProperty()), From 0aed7ef458a417fdec11ffa30eff98142359cba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Lima?= Date: Wed, 18 Oct 2023 21:22:42 +0000 Subject: [PATCH 3/4] Rename WindowsPESection based on the naming pattern and add missing _type --- stix2/v21/observables.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stix2/v21/observables.py b/stix2/v21/observables.py index 23ad8328..7fddf239 100644 --- a/stix2/v21/observables.py +++ b/stix2/v21/observables.py @@ -311,11 +311,12 @@ def _check_object_constraints(self): self._check_at_least_one_property() -class WindowsPESection(_STIXBase21): +class WindowsPESectionType(_STIXBase21): """For more detailed information on this object's properties, see `the STIX 2.1 specification `__. """ + _type = 'windows-pe-section-type' _properties = OrderedDict([ ('name', StringProperty(required=True)), ('size', IntegerProperty(min=0)), @@ -342,7 +343,7 @@ class WindowsPEBinaryExt(_Extension): ('characteristics_hex', HexProperty()), ('file_header_hashes', HashesProperty(HASHING_ALGORITHM, spec_version="2.1")), ('optional_header', EmbeddedObjectProperty(type=WindowsPEOptionalHeaderType)), - ('sections', ListProperty(EmbeddedObjectProperty(type=WindowsPESection))), + ('sections', ListProperty(EmbeddedObjectProperty(type=WindowsPESectionType))), ]) From 7fbe4cd35c107628850afd894a85e4255a2a0e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Lima?= Date: Wed, 18 Oct 2023 21:32:46 +0000 Subject: [PATCH 4/4] Rename EmailMIMEComponent based on the naming pattern and add missing _type --- stix2/v21/observables.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stix2/v21/observables.py b/stix2/v21/observables.py index 7fddf239..ecef7f5a 100644 --- a/stix2/v21/observables.py +++ b/stix2/v21/observables.py @@ -143,11 +143,12 @@ class EmailAddress(_Observable): _id_contributing_properties = ["value"] -class EmailMIMEComponent(_STIXBase21): +class EmailMIMEComponentType(_STIXBase21): """For more detailed information on this object's properties, see `the STIX 2.1 specification `__. """ + _type = 'email-mime-component-type' _properties = OrderedDict([ ('body', StringProperty()), ('body_raw_ref', ReferenceProperty(valid_types=['artifact', 'file'], spec_version='2.1')), @@ -156,7 +157,7 @@ class EmailMIMEComponent(_STIXBase21): ]) def _check_object_constraints(self): - super(EmailMIMEComponent, self)._check_object_constraints() + super(EmailMIMEComponentType, self)._check_object_constraints() self._check_at_least_one_property(['body', 'body_raw_ref']) @@ -183,7 +184,7 @@ class EmailMessage(_Observable): ('received_lines', ListProperty(StringProperty)), ('additional_header_fields', DictionaryProperty(spec_version='2.1')), ('body', StringProperty()), - ('body_multipart', ListProperty(EmbeddedObjectProperty(type=EmailMIMEComponent))), + ('body_multipart', ListProperty(EmbeddedObjectProperty(type=EmailMIMEComponentType))), ('raw_email_ref', ReferenceProperty(valid_types='artifact', spec_version='2.1')), ('object_marking_refs', ListProperty(ReferenceProperty(valid_types='marking-definition', spec_version='2.1'))), ('granular_markings', ListProperty(GranularMarking)),