def to_obj(self, return_obj=None, ns_info=None): super(Vulnerability, self).to_obj(return_obj=return_obj, ns_info=ns_info) if not return_obj: return_obj = self._binding_class() return_obj.Title = self.title return_obj.CVE_ID = self.cve_id return_obj.OSVDB_ID = self.osvdb_id return_obj.Source = self.source return_obj.is_known = utils.xml_bool(self.is_known) return_obj.is_publicly_acknowledged = utils.xml_bool(self.is_publicly_acknowledged) if self.descriptions: return_obj.Description = self.descriptions.to_obj(ns_info=ns_info) if self.short_descriptions: return_obj.Short_Description = self.short_descriptions.to_obj(ns_info=ns_info) if self.cvss_score: return_obj.CVSS_Score = self.cvss_score.to_obj(ns_info=ns_info) if self.discovered_datetime: return_obj.Discovered_DateTime = self.discovered_datetime.to_obj(ns_info=ns_info) if self.published_datetime: return_obj.Published_DateTime = self.published_datetime.to_obj(ns_info=ns_info) if self.affected_software: return_obj.Affected_Software = self.affected_software.to_obj(ns_info=ns_info) if self.references: return_obj.References = stix_common_binding.ReferencesType(Reference=self.references) return return_obj
def from_dict(cls, dict_repr, return_obj=None): if not dict_repr: return None if not return_obj: return_obj = cls() get = dict_repr.get return_obj.is_known = utils.xml_bool(get('is_known')) return_obj.is_publicly_acknowledged = utils.xml_bool( get('is_publicly_acknowledged')) return_obj.title = get('title') return_obj.description = StructuredText.from_dict(get('description')) return_obj.short_description = StructuredText.from_dict( get('short_description')) return_obj.cve_id = get('cve_id') return_obj.osvdb_id = get('osvdb_id') return_obj.source = get('source') return_obj.cvss_score = CVSSVector.from_dict(get('cvss_score')) return_obj.discovered_datetime = DateTimeWithPrecision.from_dict( get('discovered_datetime')) return_obj.published_datetime = DateTimeWithPrecision.from_dict( get('published_datetime')) return_obj.affected_software = AffectedSoftware.from_dict( get('affected_software')) return_obj.references = get('references') return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.is_known = utils.xml_bool(obj.is_known) return_obj.is_publicly_acknowledged = utils.xml_bool( obj.is_publicly_acknowledged) return_obj.title = obj.Title return_obj.description = StructuredText.from_obj(obj.Description) return_obj.short_description = StructuredText.from_obj( obj.Short_Description) return_obj.cve_id = obj.CVE_ID return_obj.osvdb_id = obj.OSVDB_ID return_obj.source = obj.Source return_obj.cvss_score = CVSSVector.from_obj(obj.CVSS_Score) return_obj.discovered_datetime = DateTimeWithPrecision.from_obj( obj.Discovered_DateTime) return_obj.published_datetime = DateTimeWithPrecision.from_obj( obj.Published_DateTime) return_obj.affected_software = AffectedSoftware.from_obj( obj.Affected_Software) if obj.References: return_obj.references = obj.References.Reference return return_obj
def from_dict(cls, dict_repr, return_obj=None): if not dict_repr: return None if not return_obj: return_obj = cls() get = dict_repr.get return_obj.is_known = utils.xml_bool(get('is_known')) return_obj.is_publicly_acknowledged = utils.xml_bool(get('is_publicly_acknowledged')) return_obj.title = get('title') return_obj.descriptions = StructuredTextList.from_dict(get('description')) return_obj.short_descriptions = StructuredTextList.from_dict(get('short_description')) return_obj.cve_id = get('cve_id') return_obj.osvdb_id = get('osvdb_id') return_obj.source = get('source') return_obj.cvss_score = CVSSVector.from_dict(get('cvss_score')) return_obj.discovered_datetime = DateTimeWithPrecision.from_dict(get('discovered_datetime')) return_obj.published_datetime = DateTimeWithPrecision.from_dict(get('published_datetime')) return_obj.affected_software = AffectedSoftware.from_dict(get('affected_software')) return_obj.references = get('references') return return_obj
def from_obj(cls, obj, return_obj=None): if not obj: return None if not return_obj: return_obj = cls() return_obj.is_known = utils.xml_bool(obj.is_known) return_obj.is_publicly_acknowledged = utils.xml_bool(obj.is_publicly_acknowledged) return_obj.title = obj.Title return_obj.descriptions = StructuredTextList.from_obj(obj.Description) return_obj.short_descriptions = StructuredTextList.from_obj(obj.Short_Description) return_obj.cve_id = obj.CVE_ID return_obj.osvdb_id = obj.OSVDB_ID return_obj.source = obj.Source return_obj.cvss_score = CVSSVector.from_obj(obj.CVSS_Score) return_obj.discovered_datetime = DateTimeWithPrecision.from_obj(obj.Discovered_DateTime) return_obj.published_datetime = DateTimeWithPrecision.from_obj(obj.Published_DateTime) return_obj.affected_software = AffectedSoftware.from_obj(obj.Affected_Software) if obj.References: return_obj.references = obj.References.Reference return return_obj
def negate(self, value): self._negate = utils.xml_bool(value)