Fixups after a rebase. There were several conflict resolutions
and I probably forgot some stuff...pull/1/head
parent
bf284d0a0b
commit
f8c86f7352
|
@ -71,7 +71,7 @@ def _detect_spec_version(stix_dict):
|
||||||
_detect_spec_version(obj) for obj in stix_dict["objects"]
|
_detect_spec_version(obj) for obj in stix_dict["objects"]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
elif obj_type in registry.STIX2_OBJ_MAPS["v21"]["observables"]:
|
elif obj_type in registry.STIX2_OBJ_MAPS["2.1"]["observables"]:
|
||||||
# Non-bundle object with an ID and without spec_version. Could be a
|
# Non-bundle object with an ID and without spec_version. Could be a
|
||||||
# 2.1 SCO or 2.0 SDO/SRO/marking. Check for 2.1 SCO...
|
# 2.1 SCO or 2.0 SDO/SRO/marking. Check for 2.1 SCO...
|
||||||
v = "2.1"
|
v = "2.1"
|
||||||
|
|
|
@ -86,7 +86,7 @@ def _register_observable(new_observable, version=DEFAULT_VERSION):
|
||||||
properties = new_observable._properties
|
properties = new_observable._properties
|
||||||
|
|
||||||
if not version:
|
if not version:
|
||||||
version = stix2.DEFAULT_VERSION
|
version = DEFAULT_VERSION
|
||||||
|
|
||||||
if version == "2.0":
|
if version == "2.0":
|
||||||
# If using STIX2.0, check properties ending in "_ref/s" are ObjectReferenceProperties
|
# If using STIX2.0, check properties ending in "_ref/s" are ObjectReferenceProperties
|
||||||
|
|
|
@ -8,7 +8,7 @@ import re
|
||||||
import pytz
|
import pytz
|
||||||
import six
|
import six
|
||||||
|
|
||||||
import stix2
|
import stix2.version
|
||||||
try:
|
try:
|
||||||
import stix2.registry as mappings
|
import stix2.registry as mappings
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -340,7 +340,7 @@ def _stix_type_of(value):
|
||||||
return type_
|
return type_
|
||||||
|
|
||||||
|
|
||||||
def is_sdo(value, stix_version=stix2.DEFAULT_VERSION):
|
def is_sdo(value, stix_version=stix2.version.DEFAULT_VERSION):
|
||||||
"""
|
"""
|
||||||
Determine whether the given object, type, or ID is/is for an SDO.
|
Determine whether the given object, type, or ID is/is for an SDO.
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ def is_sdo(value, stix_version=stix2.DEFAULT_VERSION):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def is_sco(value, stix_version=stix2.DEFAULT_VERSION):
|
def is_sco(value, stix_version=stix2.version.DEFAULT_VERSION):
|
||||||
"""
|
"""
|
||||||
Determine whether the given object, type, or ID is/is for an SCO.
|
Determine whether the given object, type, or ID is/is for an SCO.
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ def is_sco(value, stix_version=stix2.DEFAULT_VERSION):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def is_sro(value, stix_version=stix2.DEFAULT_VERSION):
|
def is_sro(value, stix_version=stix2.version.DEFAULT_VERSION):
|
||||||
"""
|
"""
|
||||||
Determine whether the given object, type, or ID is/is for an SRO.
|
Determine whether the given object, type, or ID is/is for an SRO.
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ def is_sro(value, stix_version=stix2.DEFAULT_VERSION):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def is_object(value, stix_version=stix2.DEFAULT_VERSION):
|
def is_object(value, stix_version=stix2.version.DEFAULT_VERSION):
|
||||||
"""
|
"""
|
||||||
Determine whether an object, type, or ID is/is for any STIX object. This
|
Determine whether an object, type, or ID is/is for any STIX object. This
|
||||||
includes all SDOs, SCOs, meta-objects, and bundle.
|
includes all SDOs, SCOs, meta-objects, and bundle.
|
||||||
|
@ -413,7 +413,7 @@ def is_object(value, stix_version=stix2.DEFAULT_VERSION):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def is_marking(value, stix_version=stix2.DEFAULT_VERSION):
|
def is_marking(value, stix_version=stix2.version.DEFAULT_VERSION):
|
||||||
"""Determines whether the given value is/is for a marking definition.
|
"""Determines whether the given value is/is for a marking definition.
|
||||||
|
|
||||||
:param value: A STIX object, object ID, or type as a string.
|
:param value: A STIX object, object ID, or type as a string.
|
||||||
|
@ -437,7 +437,7 @@ class STIXTypeClass(enum.Enum):
|
||||||
SRO = 2
|
SRO = 2
|
||||||
|
|
||||||
|
|
||||||
def is_stix_type(value, stix_version=stix2.DEFAULT_VERSION, *types):
|
def is_stix_type(value, stix_version=stix2.version.DEFAULT_VERSION, *types):
|
||||||
"""
|
"""
|
||||||
Determine whether the type of the given value satisfies the given
|
Determine whether the type of the given value satisfies the given
|
||||||
constraints. 'types' must contain STIX types as strings, and/or the
|
constraints. 'types' must contain STIX types as strings, and/or the
|
||||||
|
|
Loading…
Reference in New Issue