Implementation of STIX ``Vulnerability``. Args: title (optional): A string title. description (optional): A string description. short_description (optional): A string short description.
| 13 | from stix.common import References |
| 14 | |
| 15 | class Vulnerability(stix.Entity): |
| 16 | """Implementation of STIX ``Vulnerability``. |
| 17 | |
| 18 | Args: |
| 19 | title (optional): A string title. |
| 20 | description (optional): A string description. |
| 21 | short_description (optional): A string short description. |
| 22 | |
| 23 | """ |
| 24 | _binding = exploit_target_binding |
| 25 | _binding_class = _binding.VulnerabilityType |
| 26 | _namespace = "http://docs.oasis-open.org/cti/ns/stix/exploit-target-1" |
| 27 | |
| 28 | is_known = fields.BooleanField("is_known") |
| 29 | is_publicly_acknowledged = fields.BooleanField("is_publicly_acknowledged") |
| 30 | title = fields.TypedField("Title") |
| 31 | descriptions = fields.TypedField("Description", type_="stix.common.StructuredTextList") |
| 32 | short_descriptions = fields.TypedField("Short_Description", type_="stix.common.StructuredTextList") |
| 33 | cve_id = fields.TypedField("CVE_ID") |
| 34 | osvdb_id = fields.TypedField("OSVDB_ID") |
| 35 | source = fields.TypedField("Source") |
| 36 | cvss_score = fields.TypedField("CVSS_Score", "stix.exploit_target.vulnerability.CVSSVector") |
| 37 | discovered_datetime = fields.TypedField("Discovered_DateTime", DateTimeWithPrecision) |
| 38 | published_datetime = fields.TypedField("Published_DateTime", DateTimeWithPrecision) |
| 39 | affected_software = fields.TypedField("Affected_Software", "stix.exploit_target.vulnerability.AffectedSoftware") |
| 40 | references = fields.TypedField("References", References) |
| 41 | |
| 42 | def __init__(self, title=None, description=None, short_description=None): |
| 43 | super(Vulnerability, self).__init__() |
| 44 | self.title = title |
| 45 | self.descriptions = StructuredTextList(description) |
| 46 | self.short_descriptions = StructuredTextList(short_description) |
| 47 | self.references = [] |
| 48 | |
| 49 | @property |
| 50 | def description(self): |
| 51 | """A single description about the contents or purpose of this object. |
| 52 | |
| 53 | Default Value: ``None`` |
| 54 | |
| 55 | Note: |
| 56 | If this object has more than one description set, this will return |
| 57 | the description with the lowest ordinality value. |
| 58 | |
| 59 | Returns: |
| 60 | An instance of :class:`.StructuredText` |
| 61 | """ |
| 62 | return next(iter(self.descriptions or []), None) |
| 63 | |
| 64 | @description.setter |
| 65 | def description(self, value): |
| 66 | self.descriptions = value |
| 67 | |
| 68 | def add_description(self, description): |
| 69 | """Adds a description to the ``descriptions`` collection. |
| 70 | |
| 71 | This is the same as calling "foo.descriptions.add(bar)". |
| 72 | """ |
no outgoing calls
no test coverage detected