class Sighting(stix.Entity): _namespace = "http://stix.mitre.org/Indicator-2" _binding = indicator_binding _binding_class = _binding.SightingType timestamp = fields.DateTimeField("timestamp") timestamp_precision = fields.TypedField("timestamp_precision", preset_hook=validate_precision) descriptions = fields.TypedField("Description", StructuredTextList) source = fields.TypedField("Source", InformationSource) reference = fields.TypedField("Reference") confidence = fields.TypedField("Confidence", Confidence) related_observables = fields.TypedField( "Related_Observables", type_="stix.indicator.sightings.RelatedObservables") def __init__(self, timestamp=None, timestamp_precision=None, description=None): super(Sighting, self).__init__() self.timestamp = timestamp or utils.dates.now() self.timestamp_precision = timestamp_precision self.descriptions = description self.source = None self.reference = None self.confidence = None @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.descriptions or []), None) @description.setter def description(self, value): self.descriptions = StructuredTextList(value) def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description)
class Sighting(stix.Entity): _namespace = "http://stix.mitre.org/Indicator-2" _binding = indicator_binding _binding_class = _binding.SightingType timestamp = fields.DateTimeField("timestamp") timestamp_precision = fields.TypedField("timestamp_precision", preset_hook=validate_precision) descriptions = fields.TypedField("Description", StructuredTextList) source = fields.TypedField("Source", InformationSource) reference = fields.TypedField("Reference") confidence = fields.TypedField("Confidence", Confidence) related_observables = fields.TypedField("Related_Observables", type_="stix.indicator.sightings.RelatedObservables") def __init__(self, timestamp=None, timestamp_precision=None, description=None): super(Sighting, self).__init__() self.timestamp = timestamp or utils.dates.now() self.timestamp_precision = timestamp_precision self.descriptions = description self.source = None self.reference = None self.confidence = None @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.descriptions or []), None) @description.setter def description(self, value): self.descriptions = StructuredTextList(value) def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description)
class GenericTestMechanism(_BaseTestMechanism): _namespace = "http://stix.mitre.org/extensions/TestMechanism#Generic-1" _binding = generic_tm_binding _binding_class = _binding.GenericTestMechanismType _XSI_TYPE = "genericTM:GenericTestMechanismType" reference_location = fields.TypedField("reference_location") descriptions = fields.TypedField("Description", StructuredTextList) specification = fields.TypedField("Specification", EncodedCDATA) type_ = VocabField("Type") def __init__(self, id_=None, idref=None): super(GenericTestMechanism, self).__init__(id_=id_, idref=idref) self.descriptions = StructuredTextList() @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = StructuredTextList(value) def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ if self.descriptions is None: self.descriptions = StructuredTextList() self.descriptions.add(description)
class Configuration(stix.Entity): """Implementation of STIX ``Configuration``. Args: cce_id(optional): Common Configuration Enumeration value as a string description (optional): A string description. short_description (optional): A string short description. """ _binding = exploit_target_binding _binding_class = _binding.ConfigurationType _namespace = "http://stix.mitre.org/ExploitTarget-1" descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField( "Short_Description", type_="stix.common.StructuredTextList") cce_id = fields.TypedField("CCE_ID") def __init__(self, description=None, short_description=None, cce_id=None): super(Configuration, self).__init__() self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) self.cce_id = cce_id @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: return None return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ if self.descriptions is None: self.descriptions = StructuredTextList() self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = StructuredTextList() return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description)
class AttackPattern(stix.Entity): _binding = ttp_binding _binding_class = _binding.AttackPatternType _namespace = "http://stix.mitre.org/TTP-1" id_ = fields.IdField("id") idref = fields.IdrefField("idref") title = fields.TypedField("Title") capec_id = fields.TypedField("capec_id") descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField( "Short_Description", type_="stix.common.StructuredTextList") def __init__(self, id_=None, idref=None, title=None, description=None, short_description=None): super(AttackPattern, self).__init__() self.id_ = id_ self.idref = idref self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: self.descriptions = StructuredTextList() return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = StructuredTextList() return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description)
class Vulnerability(stix.Entity): """Implementation of STIX ``Vulnerability``. Args: title (optional): A string title. description (optional): A string description. short_description (optional): A string short description. """ _binding = exploit_target_binding _binding_class = _binding.VulnerabilityType _namespace = "http://stix.mitre.org/ExploitTarget-1" is_known = fields.BooleanField("is_known") is_publicly_acknowledged = fields.BooleanField("is_publicly_acknowledged") title = fields.TypedField("Title") descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField( "Short_Description", type_="stix.common.StructuredTextList") cve_id = fields.TypedField("CVE_ID") osvdb_id = fields.TypedField("OSVDB_ID") source = fields.TypedField("Source") cvss_score = fields.TypedField( "CVSS_Score", "stix.exploit_target.vulnerability.CVSSVector") discovered_datetime = fields.TypedField("Discovered_DateTime", DateTimeWithPrecision) published_datetime = fields.TypedField("Published_DateTime", DateTimeWithPrecision) affected_software = fields.TypedField( "Affected_Software", "stix.exploit_target.vulnerability.AffectedSoftware") references = fields.TypedField("References", References) def __init__(self, title=None, description=None, short_description=None): super(Vulnerability, self).__init__() self.title = title self.descriptions = StructuredTextList(description) self.short_descriptions = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.descriptions or []), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.short_descriptions or []), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description) def add_reference(self, reference): if not reference: return if self.references is None: self.references = References() self.references.append(reference)
class Infrastructure(stix.Entity): _binding = ttp_binding _binding_class = _binding.InfrastructureType _namespace = "http://stix.mitre.org/TTP-1" id_ = fields.IdField("id") idref = fields.IdrefField("idref") title = fields.TypedField("Title") descriptions = fields.TypedField("Description", StructuredTextList) short_descriptions = fields.TypedField("Short_Description", StructuredTextList) types = fields.TypedField("Type", VocabString, multiple=True, key_name="types") observable_characterization = fields.TypedField( "Observable_Characterization", Observables) def __init__(self, id_=None, idref=None, title=None, description=None, short_description=None): super(Infrastructure, self).__init__() self.id_ = id_ self.idref = idref self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: self.descriptions = StructuredTextList() return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = StructuredTextList(value) def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = StructuredTextList() return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description) def add_type(self, type_): self.types.append(type_)
class MalwareInstance(stix.Entity): _binding = ttp_binding _binding_class = _binding.MalwareInstanceType _namespace = "http://stix.mitre.org/TTP-1" _XSI_TYPE = None # defined by subclasses id_ = fields.IdField("id") idref = fields.IdrefField("idref") title = fields.TypedField("Title") descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField("Short_Description", type_="stix.common.StructuredTextList") names = vocabs.VocabField("Name", type_=VocabString, multiple=True, key_name="names") types = vocabs.VocabField("Type", type_=vocabs.MalwareType, multiple=True, key_name="types") def __init__(self, id_=None, idref=None, title=None, description=None, short_description=None): super(MalwareInstance, self).__init__() self.id_ = id_ self.idref = idref self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: self.descriptions = StructuredTextList() return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = [] return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description) def add_name(self, name): self.names.append(name) def add_type(self, type_): self.types.append(type_) @staticmethod def lookup_class(xsi_type): if not xsi_type: raise ValueError("xsi:type is required") return stix.lookup_extension(xsi_type) def to_dict(self): d = super(MalwareInstance, self).to_dict() if self._XSI_TYPE: d["xsi:type"] = self._XSI_TYPE return d
class BaseCoreComponent(Entity): _ALL_VERSIONS = () _ID_PREFIX = None title = fields.TypedField("Title") id_ = fields.IdField("id") idref = fields.IdrefField("idref") descriptions = fields.TypedField( "Description", type_="stix.common.StructuredTextList", ) short_descriptions = fields.TypedField( "Short_Description", type_="stix.common.StructuredTextList") version = fields.TypedField("version", preset_hook=_validate_version) timestamp = fields.DateTimeField("timestamp") handling = fields.TypedField("Handling", type_="stix.data_marking.Marking") def __init__(self, id_=None, idref=None, timestamp=None, title=None, description=None, short_description=None): from stix.common import StructuredTextList super(BaseCoreComponent, self).__init__() self.id_ = id_ or idgen.create_id(self._ID_PREFIX) self.idref = idref self.title = title self.descriptions = StructuredTextList(description) self.short_descriptions = StructuredTextList(short_description) if timestamp: self.timestamp = timestamp else: self.timestamp = utils.dates.now() if not idref else None @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description)
class Exploit(stix.Entity): _binding = ttp_binding _binding_class = _binding.ExploitType _namespace = "http://stix.mitre.org/TTP-1" id_ = fields.IdField("id") idref = fields.IdrefField("idref") title = fields.TypedField("Title") descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField("Short_Description", type_="stix.common.StructuredTextList") def __init__(self, id_=None, idref=None, title=None, description=None, short_description=None): super(Exploit, self).__init__() self.id_ = id_ self.idref = idref self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: self.descriptions = StructuredTextList() return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = StructuredTextList() return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description)
class STIXHeader(stix.Entity): """The STIX Package Header. Args: handling: The data marking section of the Header. information_source: The :class:`.InformationSource` section of the Header. package_intents: **DEPRECATED**. A collection of :class:`.VocabString` defining the intent of the parent :class:`.STIXPackage`. description: **DEPRECATED**. A description of the intent or purpose of the parent :class:`.STIXPackage`. short_description: **DEPRECATED**. A short description of the intent or purpose of the parent :class:`.STIXPackage`. title: **DEPRECATED**. The title of the :class:`.STIXPackage`. Attributes: profiles: A collection of STIX Profiles the parent :class:`.STIXPackage` conforms to. title: **DEPRECATED**. The title of the parent :class:`.STIXPackage`. """ _binding = stix_core_binding _binding_class = _binding.STIXHeaderType _namespace = 'http://stix.mitre.org/stix-1' title = fields.TypedField("Title", preset_hook=deprecated.field) package_intents = VocabField("Package_Intent", PackageIntent, multiple=True, preset_hook=deprecated.field) descriptions = fields.TypedField("Description", type_=StructuredTextList, preset_hook=deprecated.field) short_descriptions = fields.TypedField("Short_Description", type_=StructuredTextList, preset_hook=deprecated.field) handling = fields.TypedField("Handling", Marking) information_source = fields.TypedField("Information_Source", InformationSource) profiles = fields.TypedField("Profiles", Profiles) def __init__(self, package_intents=None, description=None, handling=None, information_source=None, title=None, short_description=None): super(STIXHeader, self).__init__() self.package_intents = package_intents self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) self.handling = handling self.information_source = information_source self.profiles = None @property def description(self): """**DEPRECATED**. A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = StructuredTextList(value) def add_description(self, description): """**DEPRECATED**. Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ deprecated.warn(description) self.descriptions.add(description) @property def short_description(self): """**DEPRECATED**. A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = StructuredTextList(value) def add_short_description(self, description): """**DEPRECATED**. Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ deprecated.warn(description) self.short_descriptions.add(description) def add_package_intent(self, package_intent): """**DEPRECATED**. Adds :class:`.VocabString` object to the :attr:`package_intents` collection. If the input is not an instance of :class:`.VocabString`, an effort will be made to convert it into an instance of :class:`.PackageIntent`. """ deprecated.warn(package_intent) self.package_intents.append(package_intent) def add_profile(self, profile): """Adds a profile to the STIX Header. A Profile is represented by a string URI. """ self.profiles.append(profile)
class Configuration(stix.Entity): """Implementation of STIX ``Configuration``. Args: cce_id(optional): Common Configuration Enumeration value as a string description (optional): A string description. short_description (optional): A string short description. """ _binding = exploit_target_binding _binding_class = _binding.ConfigurationType _namespace = "http://stix.mitre.org/ExploitTarget-1" descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField("Short_Description", type_="stix.common.StructuredTextList") cce_id = fields.TypedField("CCE_ID") def __init__(self, description=None, short_description=None, cce_id=None): super(Configuration, self).__init__() self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) self.cce_id = cce_id @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: return None return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ if self.descriptions is None: self.descriptions = StructuredTextList() self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = StructuredTextList() return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description)
class MalwareInstance(stix.Entity): _binding = ttp_binding _binding_class = _binding.MalwareInstanceType _namespace = "http://stix.mitre.org/TTP-1" _XSI_TYPE = None # defined by subclasses id_ = fields.IdField("id") idref = fields.IdrefField("idref") title = fields.TypedField("Title") descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") short_descriptions = fields.TypedField( "Short_Description", type_="stix.common.StructuredTextList") names = vocabs.VocabField("Name", type_=VocabString, multiple=True, key_name="names") types = vocabs.VocabField("Type", type_=vocabs.MalwareType, multiple=True, key_name="types") def __init__(self, id_=None, idref=None, title=None, description=None, short_description=None): super(MalwareInstance, self).__init__() self.id_ = id_ self.idref = idref self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: self.descriptions = StructuredTextList() return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = value def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = [] return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description) def add_name(self, name): self.names.append(name) def add_type(self, type_): self.types.append(type_) @staticmethod def lookup_class(xsi_type): if not xsi_type: raise ValueError("xsi:type is required") return stix.lookup_extension(xsi_type)
class Infrastructure(stix.Entity): _binding = ttp_binding _binding_class = _binding.InfrastructureType _namespace = "http://stix.mitre.org/TTP-1" id_ = fields.IdField("id") idref = fields.IdrefField("idref") title = fields.TypedField("Title") descriptions = fields.TypedField("Description", StructuredTextList) short_descriptions = fields.TypedField("Short_Description", StructuredTextList) types = fields.TypedField("Type", VocabString, multiple=True, key_name="types") observable_characterization = fields.TypedField("Observable_Characterization", Observables) def __init__(self, id_=None, idref=None, title=None, description=None, short_description=None): super(Infrastructure, self).__init__() self.id_ = id_ self.idref = idref self.title = title self.description = StructuredTextList(description) self.short_description = StructuredTextList(short_description) @property def description(self): """A single description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.descriptions is None: self.descriptions = StructuredTextList() return next(iter(self.descriptions), None) @description.setter def description(self, value): self.descriptions = StructuredTextList(value) def add_description(self, description): """Adds a description to the ``descriptions`` collection. This is the same as calling "foo.descriptions.add(bar)". """ self.descriptions.add(description) @property def short_description(self): """A single short description about the contents or purpose of this object. Default Value: ``None`` Note: If this object has more than one short description set, this will return the description with the lowest ordinality value. Returns: An instance of :class:`.StructuredText` """ if self.short_descriptions is None: self.short_descriptions = StructuredTextList() return next(iter(self.short_descriptions), None) @short_description.setter def short_description(self, value): self.short_descriptions = value def add_short_description(self, description): """Adds a description to the ``short_descriptions`` collection. This is the same as calling "foo.short_descriptions.add(bar)". """ self.short_descriptions.add(description) def add_type(self, type_): self.types.append(type_)