本文整理汇总了Python中stix.utils.dates.serialize_value函数的典型用法代码示例。如果您正苦于以下问题:Python serialize_value函数的具体用法?Python serialize_value怎么用?Python serialize_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serialize_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_dict
def to_dict(self):
if self.precision == 'second':
return serialize_value(self.value)
d = {}
d['value'] = serialize_value(self.value)
d['precision'] = self.precision
return d
示例2: to_obj
def to_obj(self, return_obj=None, ns_info=None):
super(DateTimeWithPrecision, self).to_obj(return_obj=return_obj, ns_info=ns_info)
obj = self._binding_class()
obj.valueOf_ = serialize_value(self.value)
obj.precision = self.precision
return obj
示例3: to_obj
def to_obj(self, return_obj=None):
if not return_obj:
return_obj = self._binding_class()
return_obj.set_id(self.id_)
return_obj.set_idref(self.idref)
return_obj.set_timestamp(dates.serialize_value(self.timestamp))
return_obj.set_version(self.version)
return_obj.set_Title(self.title)
if self.description:
return_obj.set_Description(self.description.to_obj())
if self.short_description:
return_obj.set_Short_Description(self.short_description.to_obj())
if self.information_source:
return_obj.set_Information_Source(self.information_source.to_obj())
if self.handling:
return_obj.set_Handling(self.handling.to_obj())
if self.potential_coas:
return_obj.set_Potential_COAs(self.potential_coas.to_obj())
if self.related_exploit_targets:
return_obj.set_Related_Exploit_Targets(self.related_exploit_targets.to_obj())
if self.vulnerabilities:
return_obj.set_Vulnerability([x.to_obj() for x in self.vulnerabilities])
if self.weaknesses:
return_obj.set_Weakness([x.to_obj() for x in self.weaknesses])
if self.configuration:
return_obj.set_Configuration([x.to_obj() for x in self.configuration])
if self.related_packages:
return_obj.set_Related_Packages(self.related_packages.to_obj())
return return_obj
示例4: to_dict
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = dates.serialize_value(self.timestamp)
if self.version:
d['version'] = self.version
if self.title:
d['title'] = self.title
if self.description:
d['description'] = self.description.to_dict()
if self.short_description:
d['short_description'] = self.short_description.to_dict()
if self.information_source:
d['information_source'] = self.information_source.to_dict()
if self.handling:
d['handling'] = self.handling.to_dict()
if self.potential_coas:
d['potential_coas'] = self.potential_coas.to_dict()
if self.related_exploit_targets:
d['related_exploit_targets'] = self.related_exploit_targets.to_dict()
if self.vulnerabilities:
d['vulnerabilities'] = [x.to_dict() for x in self.vulnerabilities]
if self.weaknesses:
d['weaknesses'] = [x.to_dict() for x in self.weaknesses]
if self.configuration:
d['configuration'] = [x.to_dict() for x in self.configuration]
if self.related_packages:
d['related_packages'] = self.related_packages.to_dict()
return d
示例5: to_dict
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.version:
d['version'] = self.version
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = dates.serialize_value(self.timestamp)
if self.stix_header:
d['stix_header'] = self.stix_header.to_dict()
if self.campaigns:
d['campaigns'] = [x.to_dict() for x in self.campaigns]
if self.courses_of_action:
d['courses_of_action'] = [x.to_dict() for x in self.courses_of_action]
if self.exploit_targets:
d['exploit_targets'] = [x.to_dict() for x in self.exploit_targets]
if self.indicators:
d['indicators'] = [x.to_dict() for x in self.indicators]
if self.observables:
d['observables'] = self.observables.to_dict()
if self.incidents:
d['incidents'] = [x.to_dict() for x in self.incidents]
if self.threat_actors:
d['threat_actors'] = [x.to_dict() for x in self.threat_actors]
if self.ttps:
d['ttps'] = self.ttps.to_dict()
if self.related_packages:
d['related_packages'] = self.related_packages.to_dict()
return d
示例6: to_obj
def to_obj(self, return_obj=None):
if not return_obj:
return_obj = self._binding_class()
return_obj.set_id(self.id_)
return_obj.set_idref(self.idref)
return_obj.set_timestamp(dates.serialize_value(self.timestamp))
return_obj.set_version(self.version)
return_obj.set_Title(self.title)
if self.description:
return_obj.set_Description(self.description.to_obj())
if self.short_description:
return_obj.set_Short_Description(self.short_description.to_obj())
if self.time:
return_obj.set_Time(self.time.to_obj())
if self.victims:
return_obj.set_Victim([x.to_obj() for x in self.victims])
if self.attributed_threat_actors:
return_obj.set_Attributed_Threat_Actors(self.attributed_threat_actors.to_obj())
if self.related_indicators:
return_obj.set_Related_Indicators(self.related_indicators.to_obj())
if self.related_observables:
return_obj.set_Related_Observables(self.related_observables.to_obj())
if self.categories:
return_obj.set_Categories(self._binding.CategoriesType(Category=[x.to_obj() for x in self.categories]))
if self.intended_effects:
return_obj.set_Intended_Effect([x.to_obj() for x in self.intended_effects])
if self.leveraged_ttps:
return_obj.set_Leveraged_TTPs(self.leveraged_ttps.to_obj())
if self.affected_assets:
a = self._binding.AffectedAssetsType(Affected_Asset=[x.to_obj() for x in self.affected_assets])
return_obj.set_Affected_Assets(a)
return return_obj
示例7: to_dict
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = dates.serialize_value(self.timestamp)
if self.version:
d['version'] = self.version or self._version
if self.title:
d['title'] = self.title
if self.description:
d['description'] = self.description.to_dict()
if self.short_description:
d['short_description'] = self.short_description.to_dict()
if self.time:
d['time'] = self.time.to_dict()
if self.victims:
d['victims'] = [x.to_dict() for x in self.victims]
if self.categories:
d['categories'] = [x.to_dict() for x in self.categories]
if self.attributed_threat_actors:
d['attributed_threat_actors'] = self.attributed_threat_actors.to_dict()
if self.related_indicators:
d['related_indicators'] = self.related_indicators.to_dict()
if self.related_observables:
d['related_observables'] = self.related_observables.to_dict()
if self.intended_effects:
d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
if self.leveraged_ttps:
d['leveraged_ttps'] = self.leveraged_ttps.to_dict()
if self.affected_assets:
d['affected_assets'] = [x.to_dict() for x in self.affected_assets]
return d
示例8: to_obj
def to_obj(self, return_obj=None, ns_info=None):
super(ExploitTarget, self).to_obj(return_obj=return_obj, ns_info=ns_info)
if not return_obj:
return_obj = self._binding_class()
return_obj.id = self.id_
return_obj.idref = self.idref
return_obj.timestamp = dates.serialize_value(self.timestamp)
return_obj.version = self.version
return_obj.Title = self.title
if self.description:
return_obj.Description = self.description.to_obj(ns_info=ns_info)
if self.short_description:
return_obj.Short_Description = self.short_description.to_obj(ns_info=ns_info)
if self.information_source:
return_obj.Information_Source = self.information_source.to_obj(ns_info=ns_info)
if self.handling:
return_obj.Handling = self.handling.to_obj(ns_info=ns_info)
if self.potential_coas:
return_obj.Potential_COAs = self.potential_coas.to_obj(ns_info=ns_info)
if self.related_exploit_targets:
return_obj.Related_Exploit_Targets = self.related_exploit_targets.to_obj(ns_info=ns_info)
if self.vulnerabilities:
return_obj.Vulnerability = [x.to_obj(ns_info=ns_info) for x in self.vulnerabilities]
if self.weaknesses:
return_obj.Weakness = [x.to_obj(ns_info=ns_info) for x in self.weaknesses]
if self.configuration:
return_obj.Configuration = [x.to_obj(ns_info=ns_info) for x in self.configuration]
if self.related_packages:
return_obj.Related_Packages = self.related_packages.to_obj(ns_info=ns_info)
return return_obj
示例9: to_dict
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = dates.serialize_value(self.timestamp)
if self.version:
d['version'] = self.version or self._version
if self.title:
d['title'] = self.title
if self.description:
d['description'] = self.description.to_dict()
if self.short_description:
d['short_description'] = self.short_description.to_dict()
if self.time:
d['time'] = self.time.to_dict()
if self.victims:
d['victims'] = [x.to_dict() for x in self.victims]
if self.categories:
d['categories'] = [x.to_dict() for x in self.categories]
if self.attributed_threat_actors:
d['attributed_threat_actors'] = self.attributed_threat_actors.to_dict()
if self.related_indicators:
d['related_indicators'] = self.related_indicators.to_dict()
if self.related_observables:
d['related_observables'] = self.related_observables.to_dict()
if self.related_incidents:
d['related_incidents'] = self.related_incidents.to_dict()
if self.intended_effects:
d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
if self.leveraged_ttps:
d['leveraged_ttps'] = self.leveraged_ttps.to_dict()
if self.affected_assets:
d['affected_assets'] = [x.to_dict() for x in self.affected_assets]
if self.discovery_methods:
d['discovery_methods'] = [x.to_dict() for x in self.discovery_methods]
if self.reporter:
d['reporter'] = self.reporter.to_dict()
if self.responders:
d['responders'] = [x.to_dict() for x in self.responders]
if self.coordinators:
d['coordinators'] = [x.to_dict() for x in self.coordinators]
if self.external_ids:
d['external_ids'] = [x.to_dict() for x in self.external_ids]
if self.impact_assessment:
d['impact_assessment'] = self.impact_assessment.to_dict()
if self.information_source:
d['information_source'] = self.information_source.to_dict()
if self.security_compromise:
d['security_compromise'] = self.security_compromise.to_dict()
if self.confidence:
d['confidence'] = self.confidence.to_dict()
if self.coa_taken:
d['coa_taken'] = [x.to_dict() for x in self.coa_taken]
return d
示例10: to_obj
def to_obj(self, return_obj=None):
if not return_obj:
return_obj = self._binding_class()
return_obj.set_id(self.id_)
return_obj.set_idref(self.idref)
return_obj.set_timestamp(dates.serialize_value(self.timestamp))
return_obj.set_version(self.version)
return_obj.set_Title(self.title)
if self.description:
return_obj.set_Description(self.description.to_obj())
if self.short_description:
return_obj.set_Short_Description(self.short_description.to_obj())
if self.time:
return_obj.set_Time(self.time.to_obj())
if self.victims:
return_obj.set_Victim([x.to_obj() for x in self.victims])
if self.attributed_threat_actors:
return_obj.set_Attributed_Threat_Actors(self.attributed_threat_actors.to_obj())
if self.related_indicators:
return_obj.set_Related_Indicators(self.related_indicators.to_obj())
if self.related_observables:
return_obj.set_Related_Observables(self.related_observables.to_obj())
if self.related_incidents:
return_obj.set_Related_Incidents(self.related_incidents.to_obj())
if self.categories:
return_obj.set_Categories(self._binding.CategoriesType(Category=[x.to_obj() for x in self.categories]))
if self.intended_effects:
return_obj.set_Intended_Effect([x.to_obj() for x in self.intended_effects])
if self.leveraged_ttps:
return_obj.set_Leveraged_TTPs(self.leveraged_ttps.to_obj())
if self.affected_assets:
a = self._binding.AffectedAssetsType(Affected_Asset=[x.to_obj() for x in self.affected_assets])
return_obj.set_Affected_Assets(a)
if self.discovery_methods:
return_obj.set_Discovery_Method([x.to_obj() for x in self.discovery_methods])
if self.reporter:
return_obj.set_Reporter(self.reporter.to_obj())
if self.responders:
return_obj.set_Responder([x.to_obj() for x in self.responders])
if self.coordinators:
return_obj.set_Coordinator([x.to_obj() for x in self.coordinators])
if self.external_ids:
return_obj.set_External_ID([x.to_obj() for x in self.external_ids])
if self.impact_assessment:
return_obj.set_Impact_Assessment(self.impact_assessment.to_obj())
if self.information_source:
return_obj.set_Information_Source(self.information_source.to_obj())
if self.security_compromise:
return_obj.set_Security_Compromise(self.security_compromise.to_obj())
if self.confidence:
return_obj.set_Confidence(self.confidence.to_obj())
if self.coa_taken:
return_obj.set_COA_Taken([x.to_obj() for x in self.coa_taken])
return return_obj
示例11: to_obj
def to_obj(self, return_obj=None):
if not return_obj:
return_obj = self._binding_class()
return_obj.set_valueOf_(self.value)
return_obj.set_author(self.author)
return_obj.set_time(serialize_value(self.time))
return_obj.set_time_precision(self.time_precision)
return return_obj
示例12: to_obj
def to_obj(self, return_obj=None):
if not return_obj:
return_obj = self._binding_class()
return_obj.set_id(self.id_)
return_obj.set_idref(self.idref)
return_obj.set_timestamp(dates.serialize_value(self.timestamp))
return_obj.set_Title(self.title)
if self.version:
return_obj.set_version(self._version)
if self.description:
return_obj.set_Description(self.description.to_obj())
if self.short_description:
return_obj.set_Short_Description(self.short_description.to_obj())
if self.confidence:
return_obj.set_Confidence(self.confidence.to_obj())
if self.indicator_types:
for indicator_type in self.indicator_types:
tmp_indicator_type = indicator_type.to_obj()
return_obj.add_Type(tmp_indicator_type)
if self.indicated_ttps:
return_obj.set_Indicated_TTP([x.to_obj() for x in self.indicated_ttps])
if self.observables:
if len(self.observables) > 1:
root_observable = self._merge_observables(self.observables)
else:
root_observable = self.observables[0]
return_obj.set_Observable(root_observable.to_obj())
if self.producer:
return_obj.set_Producer(self.producer.to_obj())
if self.test_mechanisms:
tms_obj = self._binding.TestMechanismsType()
tms_obj.set_Test_Mechanism([x.to_obj() for x in self.test_mechanisms])
return_obj.set_Test_Mechanisms(tms_obj)
if self.likely_impact:
return_obj.set_Likely_Impact(self.likely_impact.to_obj())
if self.alternative_id:
return_obj.set_Alternative_ID(self.alternative_id)
if self.valid_time_positions:
return_obj.set_Valid_Time_Position([x.to_obj() for x in self.valid_time_positions])
if self.suggested_coas:
return_obj.set_Suggested_COAs(self.suggested_coas.to_obj())
if self.sightings:
return_obj.set_Sightings(self.sightings.to_obj())
if self.composite_indicator_expression:
return_obj.set_Composite_Indicator_Expression(self.composite_indicator_expression.to_obj())
if self.handling:
return_obj.set_Handling(self.handling.to_obj())
if self.kill_chain_phases:
return_obj.set_Kill_Chain_Phases(self.kill_chain_phases.to_obj())
if self.related_indicators:
return_obj.set_Related_Indicators(self.related_indicators.to_obj())
return return_obj
示例13: to_obj
def to_obj(self, return_obj=None, ns_info=None):
super(STIXPackage, self).to_obj(return_obj=return_obj, ns_info=ns_info)
if not return_obj:
return_obj = self._binding_class()
return_obj.id = self.id_
return_obj.idref = self.idref
return_obj.version = self.version
return_obj.timestamp = dates.serialize_value(self.timestamp)
if self.stix_header:
return_obj.STIX_Header = self.stix_header.to_obj(ns_info=ns_info)
if self.campaigns:
coas_obj = self._binding.CampaignsType()
coas_obj.Campaign = [x.to_obj(ns_info=ns_info) for x in self.campaigns]
return_obj.Campaigns = coas_obj
if self.courses_of_action:
coas_obj = self._binding.CoursesOfActionType()
coas_obj.Course_Of_Action = [x.to_obj(ns_info=ns_info) for x in self.courses_of_action]
return_obj.Courses_Of_Action = coas_obj
if self.exploit_targets:
et_obj = stix_common_binding.ExploitTargetsType()
et_obj.Exploit_Target = [x.to_obj(ns_info=ns_info) for x in self.exploit_targets]
return_obj.Exploit_Targets = et_obj
if self.indicators:
indicators_obj = self._binding.IndicatorsType()
indicators_obj.Indicator = [x.to_obj(ns_info=ns_info) for x in self.indicators]
return_obj.Indicators = indicators_obj
if self.observables:
return_obj.Observables = self.observables.to_obj(ns_info=ns_info)
if self.incidents:
incidents_obj = self._binding.IncidentsType()
incidents_obj.Incident = [x.to_obj(ns_info=ns_info) for x in self.incidents]
return_obj.Incidents = incidents_obj
if self.threat_actors:
threat_actors_obj = self._binding.ThreatActorsType()
threat_actors_obj.Threat_Actor = [x.to_obj(ns_info=ns_info) for x in self.threat_actors]
return_obj.Threat_Actors = threat_actors_obj
if self.ttps:
return_obj.TTPs = self.ttps.to_obj(ns_info=ns_info)
if self.related_packages:
return_obj.Related_Packages = self.related_packages.to_obj(ns_info=ns_info)
return return_obj
示例14: to_obj
def to_obj(self, return_obj=None, ns_info=None):
super(JournalEntry, self).to_obj(return_obj=return_obj, ns_info=ns_info)
if not return_obj:
return_obj = self._binding_class()
return_obj.valueOf_ = self.value
return_obj.author = self.author
return_obj.time = serialize_value(self.time)
return_obj.time_precision = self.time_precision
return return_obj
示例15: to_dict
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = dates.serialize_value(self.timestamp)
if self.version:
d['version'] = self.version
if self.observables:
if len(self.observables) == 1:
d['observable'] = self.observables[0].to_dict()
else:
composite_observable = self._merge_observables(self.observables)
d['observable'] = composite_observable.to_dict()
if self.producer:
d['producer'] = self.producer.to_dict()
if self.title:
d['title'] = self.title
if self.description:
d['description'] = self.description.to_dict()
if self.short_description:
d['short_description'] = self.short_description.to_dict()
if self.indicator_types:
d['indicator_types'] = [x.to_dict() for x in self.indicator_types]
if self.confidence:
d['confidence'] = self.confidence.to_dict()
if self.indicated_ttps:
d['indicated_ttps'] = [x.to_dict() for x in self.indicated_ttps]
if self.test_mechanisms:
d['test_mechanisms'] = [x.to_dict() for x in self.test_mechanisms]
if self.likely_impact:
d['likely_impact'] = self.likely_impact.to_dict()
if self.alternative_id:
d['alternative_id'] = self.alternative_id
if self.valid_time_positions:
d['valid_time_positions'] = [x.to_dict() for x in self.valid_time_positions]
if self.suggested_coas:
d['suggested_coas'] = self.suggested_coas.to_dict()
if self.sightings:
d['sightings'] = self.sightings.to_dict()
if self.composite_indicator_expression:
d['composite_indicator_expression'] = self.composite_indicator_expression.to_dict()
if self.handling:
d['handling'] = self.handling.to_dict()
if self.kill_chain_phases:
d['kill_chain_phases'] = self.kill_chain_phases.to_dict()
if self.related_indicators:
d['related_indicators'] = self.related_indicators.to_dict()
return d