From 61d3652514650c0026b58d566a0f81b1dcb9e2e4 Mon Sep 17 00:00:00 2001 From: clenk Date: Thu, 23 Feb 2017 10:11:56 -0500 Subject: [PATCH] Add more SDO skeletons - Campaign - CourseOfAction - Identity - ObservedData - Report - ThreatActor - Vulnerability --- stix2/sdo.py | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/stix2/sdo.py b/stix2/sdo.py index 4e5214b..8f2d941 100644 --- a/stix2/sdo.py +++ b/stix2/sdo.py @@ -33,6 +33,91 @@ class AttackPattern(_STIXBase): super(AttackPattern, self).__init__(**kwargs) +class Campaign(_STIXBase): + + _type = 'campaign' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'name': { + 'required': True, + }, + 'description': {}, + 'aliases': {}, + 'first_seen': {}, + 'last_seen': {}, + 'objective': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - description + # - aliases + # - first_seen + # - last_seen + # - objective + + super(Campaign, self).__init__(**kwargs) + + +class CourseOfAction(_STIXBase): + + _type = 'course-of-action' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'name': { + 'required': True, + }, + 'description': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - description + + super(CourseOfAction, self).__init__(**kwargs) + + +class Identity(_STIXBase): + + _type = 'identity' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'name': { + 'required': True, + }, + 'description': {}, + 'identity_class': { + 'required': True, + }, + 'sectors': {}, + 'contact_information': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - description + # - identity_class + # - sectors + # - contact_information + + super(Identity, self).__init__(**kwargs) + + class Indicator(_STIXBase): _type = 'indicator' @@ -133,6 +218,104 @@ class Malware(_STIXBase): super(Malware, self).__init__(**kwargs) +class ObservedData(_STIXBase): + + _type = 'observed-data' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'first_observed': {}, + 'last_observed': {}, + 'number_observed': {}, + 'objects': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - first_observed + # - last_observed + # - number_observed + # - objects + + super(ObservedData, self).__init__(**kwargs) + + +class Report(_STIXBase): + + _type = 'report' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'labels': { + 'required': True, + }, + 'name': { + 'required': True, + }, + 'description': {}, + 'published': {}, + 'object_refs': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - description + # - published + # - object_refs + + super(Report, self).__init__(**kwargs) + + +class ThreatActor(_STIXBase): + + _type = 'threat-actor' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'labels': { + 'required': True, + }, + 'name': { + 'required': True, + }, + 'description': {}, + 'aliases': {}, + 'roles': {}, + 'goals': {}, + 'sophistication': {}, + 'resource_level': {}, + 'primary_motivation': {}, + 'secondary_motivations': {}, + 'personal_motivations': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - description + # - aliases + # - roles + # - goals + # - sophistication + # - resource_level + # - primary_motivation + # - secondary_motivations + # - personal_motivations + + super(ThreatActor, self).__init__(**kwargs) + + class Tool(_STIXBase): _type = 'tool' @@ -161,3 +344,26 @@ class Tool(_STIXBase): # - tool_version super(Tool, self).__init__(**kwargs) + + +class Vulnerability(_STIXBase): + + _type = 'vulnerability' + _properties = COMMON_PROPERTIES.copy() + _properties.update({ + 'name': { + 'required': True, + }, + 'description': {}, + }) + + def __init__(self, **kwargs): + # TODO: + # - created_by_ref + # - external_references + # - object_marking_refs + # - granular_markings + + # - description + + super(Vulnerability, self).__init__(**kwargs)