From 2886ae9961c026b0a3888de6b52b2e253f74d786 Mon Sep 17 00:00:00 2001 From: Chris Lenk Date: Wed, 21 Feb 2018 16:42:25 -0500 Subject: [PATCH] Add links to specs in STIX Objects' documentation --- stix2/core.py | 3 ++ stix2/v20/common.py | 26 +++++++++- stix2/v20/observables.py | 108 +++++++++++++++++++++++++++++++++++++++ stix2/v20/sdo.py | 36 +++++++++++++ stix2/v20/sro.py | 7 +++ 5 files changed, 179 insertions(+), 1 deletion(-) diff --git a/stix2/core.py b/stix2/core.py index 658bb47..b6d295d 100644 --- a/stix2/core.py +++ b/stix2/core.py @@ -41,6 +41,9 @@ class STIXObjectProperty(Property): class Bundle(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'bundle' _properties = OrderedDict() diff --git a/stix2/v20/common.py b/stix2/v20/common.py index ef45060..e915df6 100644 --- a/stix2/v20/common.py +++ b/stix2/v20/common.py @@ -11,6 +11,10 @@ from ..utils import NOW, get_dict class ExternalReference(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + _properties = OrderedDict() _properties.update([ ('source_name', StringProperty(required=True)), @@ -26,6 +30,10 @@ class ExternalReference(_STIXBase): class KillChainPhase(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + _properties = OrderedDict() _properties.update([ ('kill_chain_name', StringProperty(required=True)), @@ -34,6 +42,10 @@ class KillChainPhase(_STIXBase): class GranularMarking(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + _properties = OrderedDict() _properties.update([ ('marking_ref', ReferenceProperty(required=True, type="marking-definition")), @@ -42,15 +54,23 @@ class GranularMarking(_STIXBase): class TLPMarking(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + # TODO: don't allow the creation of any other TLPMarkings than the ones below _type = 'tlp' _properties = OrderedDict() _properties.update([ - ('tlp', Property(required=True)) + ('tlp', StringProperty(required=True)) ]) class StatementMarking(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + _type = 'statement' _properties = OrderedDict() _properties.update([ @@ -78,6 +98,10 @@ class MarkingProperty(Property): class MarkingDefinition(_STIXBase, _MarkingsMixin): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + _type = 'marking-definition' _properties = OrderedDict() _properties.update([ diff --git a/stix2/v20/observables.py b/stix2/v20/observables.py index a874df9..1adde90 100644 --- a/stix2/v20/observables.py +++ b/stix2/v20/observables.py @@ -74,6 +74,9 @@ class ExtensionsProperty(DictionaryProperty): class Artifact(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'artifact' _properties = OrderedDict() @@ -93,6 +96,9 @@ class Artifact(_Observable): class AutonomousSystem(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'autonomous-system' _properties = OrderedDict() @@ -106,6 +112,9 @@ class AutonomousSystem(_Observable): class Directory(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'directory' _properties = OrderedDict() @@ -123,6 +132,9 @@ class Directory(_Observable): class DomainName(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'domain-name' _properties = OrderedDict() @@ -135,6 +147,9 @@ class DomainName(_Observable): class EmailAddress(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'email-addr' _properties = OrderedDict() @@ -148,6 +163,9 @@ class EmailAddress(_Observable): class EmailMIMEComponent(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _properties = OrderedDict() _properties.update([ @@ -163,6 +181,9 @@ class EmailMIMEComponent(_STIXBase): class EmailMessage(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'email-message' _properties = OrderedDict() @@ -194,6 +215,9 @@ class EmailMessage(_Observable): class ArchiveExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'archive-ext' _properties = OrderedDict() @@ -205,6 +229,9 @@ class ArchiveExt(_Extension): class AlternateDataStream(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _properties = OrderedDict() _properties.update([ @@ -215,6 +242,9 @@ class AlternateDataStream(_STIXBase): class NTFSExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'ntfs-ext' _properties = OrderedDict() @@ -225,6 +255,9 @@ class NTFSExt(_Extension): class PDFExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'pdf-ext' _properties = OrderedDict() @@ -238,6 +271,9 @@ class PDFExt(_Extension): class RasterImageExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'raster-image-ext' _properties = OrderedDict() @@ -251,6 +287,9 @@ class RasterImageExt(_Extension): class WindowsPEOptionalHeaderType(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _properties = OrderedDict() _properties.update([ @@ -293,6 +332,9 @@ class WindowsPEOptionalHeaderType(_STIXBase): class WindowsPESection(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _properties = OrderedDict() _properties.update([ @@ -304,6 +346,9 @@ class WindowsPESection(_STIXBase): class WindowsPEBinaryExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'windows-pebinary-ext' _properties = OrderedDict() @@ -324,6 +369,9 @@ class WindowsPEBinaryExt(_Extension): class File(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'file' _properties = OrderedDict() @@ -355,6 +403,9 @@ class File(_Observable): class IPv4Address(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'ipv4-addr' _properties = OrderedDict() @@ -368,6 +419,9 @@ class IPv4Address(_Observable): class IPv6Address(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'ipv6-addr' _properties = OrderedDict() @@ -381,6 +435,9 @@ class IPv6Address(_Observable): class MACAddress(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'mac-addr' _properties = OrderedDict() @@ -392,6 +449,9 @@ class MACAddress(_Observable): class Mutex(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'mutex' _properties = OrderedDict() @@ -403,6 +463,9 @@ class Mutex(_Observable): class HTTPRequestExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'http-request-ext' _properties = OrderedDict() @@ -417,6 +480,9 @@ class HTTPRequestExt(_Extension): class ICMPExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'icmp-ext' _properties = OrderedDict() @@ -427,6 +493,9 @@ class ICMPExt(_Extension): class SocketExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'socket-ext' _properties = OrderedDict() @@ -465,6 +534,9 @@ class SocketExt(_Extension): class TCPExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'tcp-ext' _properties = OrderedDict() @@ -475,6 +547,9 @@ class TCPExt(_Extension): class NetworkTraffic(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'network-traffic' _properties = OrderedDict() @@ -506,6 +581,9 @@ class NetworkTraffic(_Observable): class WindowsProcessExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'windows-process-ext' _properties = OrderedDict() @@ -520,6 +598,9 @@ class WindowsProcessExt(_Extension): class WindowsServiceExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'windows-service-ext' _properties = OrderedDict() @@ -555,6 +636,9 @@ class WindowsServiceExt(_Extension): class Process(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'process' _properties = OrderedDict() @@ -593,6 +677,9 @@ class Process(_Observable): class Software(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'software' _properties = OrderedDict() @@ -608,6 +695,9 @@ class Software(_Observable): class URL(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'url' _properties = OrderedDict() @@ -619,6 +709,9 @@ class URL(_Observable): class UNIXAccountExt(_Extension): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'unix-account-ext' _properties = OrderedDict() @@ -631,6 +724,9 @@ class UNIXAccountExt(_Extension): class UserAccount(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'user-account' _properties = OrderedDict() @@ -654,6 +750,9 @@ class UserAccount(_Observable): class WindowsRegistryValueType(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'windows-registry-value-type' _properties = OrderedDict() @@ -679,6 +778,9 @@ class WindowsRegistryValueType(_STIXBase): class WindowsRegistryKey(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'windows-registry-key' _properties = OrderedDict() @@ -700,6 +802,9 @@ class WindowsRegistryKey(_Observable): class X509V3ExtenstionsType(_STIXBase): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'x509-v3-extensions-type' _properties = OrderedDict() @@ -724,6 +829,9 @@ class X509V3ExtenstionsType(_STIXBase): class X509Certificate(_Observable): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'x509-certificate' _properties = OrderedDict() diff --git a/stix2/v20/sdo.py b/stix2/v20/sdo.py index 2d36aaf..7ccc3e3 100644 --- a/stix2/v20/sdo.py +++ b/stix2/v20/sdo.py @@ -19,6 +19,9 @@ class STIXDomainObject(_STIXBase, _MarkingsMixin): class AttackPattern(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'attack-pattern' _properties = OrderedDict() @@ -40,6 +43,9 @@ class AttackPattern(STIXDomainObject): class Campaign(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'campaign' _properties = OrderedDict() @@ -64,6 +70,9 @@ class Campaign(STIXDomainObject): class CourseOfAction(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'course-of-action' _properties = OrderedDict() @@ -84,6 +93,9 @@ class CourseOfAction(STIXDomainObject): class Identity(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'identity' _properties = OrderedDict() @@ -107,6 +119,9 @@ class Identity(STIXDomainObject): class Indicator(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'indicator' _properties = OrderedDict() @@ -131,6 +146,9 @@ class Indicator(STIXDomainObject): class IntrusionSet(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'intrusion-set' _properties = OrderedDict() @@ -158,6 +176,9 @@ class IntrusionSet(STIXDomainObject): class Malware(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'malware' _properties = OrderedDict() @@ -179,6 +200,9 @@ class Malware(STIXDomainObject): class ObservedData(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'observed-data' _properties = OrderedDict() @@ -201,6 +225,9 @@ class ObservedData(STIXDomainObject): class Report(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'report' _properties = OrderedDict() @@ -223,6 +250,9 @@ class Report(STIXDomainObject): class ThreatActor(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'threat-actor' _properties = OrderedDict() @@ -251,6 +281,9 @@ class ThreatActor(STIXDomainObject): class Tool(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'tool' _properties = OrderedDict() @@ -273,6 +306,9 @@ class Tool(STIXDomainObject): class Vulnerability(STIXDomainObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'vulnerability' _properties = OrderedDict() diff --git a/stix2/v20/sro.py b/stix2/v20/sro.py index 7f05f5e..7d7d3ae 100644 --- a/stix2/v20/sro.py +++ b/stix2/v20/sro.py @@ -16,6 +16,9 @@ class STIXRelationshipObject(_STIXBase, _MarkingsMixin): class Relationship(STIXRelationshipObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ _type = 'relationship' _properties = OrderedDict() @@ -51,6 +54,10 @@ class Relationship(STIXRelationshipObject): class Sighting(STIXRelationshipObject): + """For more detailed information on this object's properties, see + `the STIX 2.0 specification `__. + """ + _type = 'sighting' _properties = OrderedDict() _properties.update([