本文整理汇总了Python中stix.common.related.RelatedPackageRefs.to_dict方法的典型用法代码示例。如果您正苦于以下问题:Python RelatedPackageRefs.to_dict方法的具体用法?Python RelatedPackageRefs.to_dict怎么用?Python RelatedPackageRefs.to_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stix.common.related.RelatedPackageRefs
的用法示例。
在下文中一共展示了RelatedPackageRefs.to_dict方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ThreatActor
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
return return_obj
@classmethod
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.id
return_obj.idref = obj.idref
return_obj.timestamp = obj.timestamp
if isinstance(obj, cls._binding_class): # ThreatActorType properties
return_obj.version = obj.version
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.identity = Identity.from_obj(obj.Identity)
return_obj.types = [Statement.from_obj(x) for x in obj.Type]
return_obj.motivations = [Statement.from_obj(x) for x in obj.Motivation]
return_obj.sophistications = [Statement.from_obj(x) for x in obj.Sophistication]
return_obj.intended_effects = [Statement.from_obj(x) for x in obj.Intended_Effect]
return_obj.planning_and_operational_supports = [Statement.from_obj(x) for x in obj.Planning_And_Operational_Support]
return_obj.observed_ttps = ObservedTTPs.from_obj(obj.Observed_TTPs)
return_obj.associated_campaigns = AssociatedCampaigns.from_obj(obj.Associated_Campaigns)
return_obj.associated_actors = AssociatedActors.from_obj(obj.Associated_Actors)
return_obj.handling = Marking.from_obj(obj.Handling)
return_obj.confidence = Confidence.from_obj(obj.Confidence)
return_obj.information_source = InformationSource.from_obj(obj.Information_Source)
return_obj.related_packages = RelatedPackageRefs.from_obj(obj.Related_Packages)
return return_obj
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.identity:
d['identity'] = self.identity.to_dict()
if self.types:
d['types'] = [x.to_dict() for x in self.types]
if self.motivations:
d['motivations'] = [x.to_dict() for x in self.motivations]
if self.sophistications:
d['sophistications'] = [x.to_dict() for x in self.sophistications]
if self.intended_effects:
d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
if self.planning_and_operational_supports:
d['planning_and_operational_supports'] = [x.to_dict()
for x in self.planning_and_operational_supports]
if self.observed_ttps:
d['observed_ttps'] = self.observed_ttps.to_dict()
if self.associated_campaigns:
d['associated_campaigns'] = self.associated_campaigns.to_dict()
示例2: ExploitTarget
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
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
@classmethod
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.id
return_obj.idref = obj.idref
return_obj.timestamp = obj.timestamp # not yet implemented
if isinstance(obj, cls._binding_class): # TTPType properties
return_obj.version = obj.version
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.information_source = InformationSource.from_obj(obj.Information_Source)
return_obj.handling = Marking.from_obj(obj.Handling)
return_obj.potential_coas = PotentialCOAs.from_obj(obj.Potential_COAs)
return_obj.related_exploit_targets = RelatedExploitTargets.from_obj(obj.Related_Exploit_Targets)
return_obj.vulnerabilities = [Vulnerability.from_obj(x) for x in obj.Vulnerability]
return_obj.weaknesses = [Weakness.from_obj(x) for x in obj.Weakness]
return_obj.configuration = [Configuration.from_obj(x) for x in obj.Configuration]
return_obj.related_packages = RelatedPackageRefs.from_obj(obj.Related_Packages)
return return_obj
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
@classmethod
def from_dict(cls, dict_repr, return_obj=None):
if not dict_repr:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = dict_repr.get('id')
return_obj.idref = dict_repr.get('idref')
return_obj.timestamp = dict_repr.get('timestamp')
return_obj.version = dict_repr.get('version')
return_obj.title = dict_repr.get('title')
return_obj.description = StructuredText.from_dict(dict_repr.get('description'))
return_obj.short_description = StructuredText.from_dict(dict_repr.get('short_description'))
return_obj.information_source = InformationSource.from_dict(dict_repr.get('information_source'))
return_obj.handling = Marking.from_dict(dict_repr.get('handling'))
return_obj.potential_coas = PotentialCOAs.from_dict(dict_repr.get('potential_coas'))
return_obj.related_exploit_targets = RelatedExploitTargets.from_dict(dict_repr.get('related_exploit_targets'))
return_obj.vulnerabilities = [Vulnerability.from_dict(x) for x in dict_repr.get('vulnerabilities', [])]
return_obj.weaknesses = [Weakness.from_dict(x) for x in dict_repr.get('weaknesses', [])]
return_obj.configuration = [Configuration.from_dict(x) for x in dict_repr.get('configuration', [])]
return_obj.related_packages = RelatedPackageRefs.from_dict(dict_repr.get('related_packages'))
return return_obj
示例3: CourseOfAction
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
@classmethod
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.id
return_obj.idref = obj.idref
return_obj.timestamp = obj.timestamp
if isinstance(obj, cls._binding_class): # CourseOfActionType properties
return_obj.version = obj.version
return_obj.title = obj.Title
return_obj.stage = VocabString.from_obj(obj.Stage)
return_obj.type_ = VocabString.from_obj(obj.Type)
return_obj.description = StructuredText.from_obj(obj.Description)
return_obj.short_description = StructuredText.from_obj(obj.Short_Description)
return_obj.objective = Objective.from_obj(obj.Objective)
return_obj.parameter_observables = \
Observables.from_obj(obj.Parameter_Observables)
return_obj.impact = Statement.from_obj(obj.Impact)
return_obj.cost = Statement.from_obj(obj.Cost)
return_obj.efficacy = Statement.from_obj(obj.Efficacy)
return_obj.information_source = InformationSource.from_obj(obj.Information_Source)
return_obj.handling = Marking.from_obj(obj.Handling)
return_obj.related_coas = \
RelatedCOAs.from_obj(obj.Related_COAs)
return_obj.related_packages = \
RelatedPackageRefs.from_obj(obj.Related_Packages)
return return_obj
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = self.timestamp.isoformat()
if self.version:
d['version'] = self.version
if self.title:
d['title'] = self.title
if self.stage:
d['stage'] = self.stage.to_dict()
if self.type_:
d['type'] = self.type_.to_dict()
if self.description:
d['description'] = self.description.to_dict()
if self.short_description:
d['short_description'] = self.short_description.to_dict()
if self.objective:
d['objective'] = self.objective.to_dict()
if self.parameter_observables:
d['parameter_observables'] = self.parameter_observables.to_dict()
if self.impact:
d['impact'] = self.impact.to_dict()
if self.cost:
d['cost'] = self.cost.to_dict()
if self.efficacy:
d['efficacy'] = self.efficacy.to_dict()
if self.type_:
d['type'] = self.type_.to_dict()
if self.information_source:
示例4: Campaign
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
return_obj.idref = obj.get_idref()
return_obj.timestamp = obj.get_timestamp()
if isinstance(obj, cls._binding_class):
return_obj.version = obj.get_version() or cls._version
return_obj.title = obj.get_Title()
return_obj.description = StructuredText.from_obj(obj.get_Description())
return_obj.short_description = \
StructuredText.from_obj(obj.get_Short_Description())
return_obj.names = Names.from_obj(obj.get_Names())
return_obj.intended_effect = \
[Statement.from_obj(x) for x in obj.get_Intended_Effect()]
return_obj.status = VocabString.from_obj(obj.get_Status())
return_obj.related_ttps = RelatedTTPs.from_obj(obj.get_Related_TTPs())
return_obj.related_incidents = \
RelatedIncidents.from_obj(obj.get_Related_Incidents())
return_obj.related_indicators = \
RelatedIndicators.from_obj(obj.get_Related_Indicators())
return_obj.attribution = \
[Attribution.from_obj(x) for x in obj.get_Attribution()]
return_obj.associated_campaigns = \
AssociatedCampaigns.from_obj(obj.get_Associated_Campaigns())
return_obj.confidence = Confidence.from_obj(obj.get_Confidence())
return_obj.activity = \
[Activity.from_obj(x) for x in obj.get_Activity()]
return_obj.information_source = \
InformationSource.from_obj(obj.get_Information_Source())
return_obj.handling = Marking.from_obj(obj.get_Handling())
return_obj.related_packages = \
RelatedPackageRefs.from_obj(obj.get_Related_Packages())
return return_obj
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = self.timestamp.isoformat()
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.names:
d['names'] = self.names.to_dict()
if self.intended_effect:
d['intended_effect'] = [x.to_dict() for x in self.intended_effect]
if self.status:
d['status'] = self.status.to_dict()
if self.related_ttps:
d['related_ttps'] = self.related_ttps.to_dict()
if self.related_incidents:
d['related_incidents'] = self.related_incidents.to_dict()
if self.related_indicators:
d['related_indicators'] = self.related_indicators.to_dict()
if self.attribution:
d['attribution'] = [x.to_dict() for x in self.attribution]
if self.associated_campaigns:
d['associated_campaigns'] = self.associated_campaigns.to_dict()
if self.confidence:
示例5: ExploitTarget
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
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
@classmethod
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.get_id()
return_obj.idref = obj.get_idref()
return_obj.timestamp = obj.get_timestamp() # not yet implemented
if isinstance(obj, cls._binding_class): # TTPType properties
return_obj.version = obj.get_version() or cls._version
return_obj.title = obj.get_Title()
return_obj.description = StructuredText.from_obj(obj.get_Description())
return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description())
return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source())
return_obj.handling = Marking.from_obj(obj.get_Handling())
return_obj.potential_coas = PotentialCOAs.from_obj(obj.get_Potential_COAs())
return_obj.related_exploit_targets = RelatedExploitTargets.from_obj(obj.get_Related_Exploit_Targets())
return_obj.vulnerabilities = [Vulnerability.from_obj(x) for x in obj.get_Vulnerability()]
return_obj.weaknesses = [Weakness.from_obj(x) for x in obj.get_Weakness()]
return_obj.configuration = [Configuration.from_obj(x) for x in obj.get_Configuration()]
return_obj.related_packages = RelatedPackageRefs.from_obj(obj.get_Related_Packages())
return return_obj
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.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
@classmethod
def from_dict(cls, dict_repr, return_obj=None):
if not dict_repr:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = dict_repr.get('id')
return_obj.idref = dict_repr.get('idref')
return_obj.timestamp = dict_repr.get('timestamp')
return_obj.version = dict_repr.get('version', cls._version)
return_obj.title = dict_repr.get('title')
return_obj.description = StructuredText.from_dict(dict_repr.get('description'))
return_obj.short_description = StructuredText.from_dict(dict_repr.get('short_description'))
return_obj.information_source = InformationSource.from_dict(dict_repr.get('information_source'))
return_obj.handling = Marking.from_dict(dict_repr.get('handling'))
return_obj.potential_coas = PotentialCOAs.from_dict(dict_repr.get('potential_coas'))
return_obj.related_exploit_targets = RelatedExploitTargets.from_dict(dict_repr.get('related_exploit_targets'))
return_obj.vulnerabilities = [Vulnerability.from_dict(x) for x in dict_repr.get('vulnerabilities', [])]
return_obj.weaknesses = [Weakness.from_dict(x) for x in dict_repr.get('weaknesses', [])]
return_obj.configuration = [Configuration.from_dict(x) for x in dict_repr.get('configuration', [])]
return_obj.related_packages = RelatedPackageRefs.from_dict(dict_repr.get('related_packages'))
return return_obj
示例6: Campaign
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
return_obj.idref = obj.idref
return_obj.timestamp = obj.timestamp
if isinstance(obj, cls._binding_class):
return_obj.version = obj.version
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.names = Names.from_obj(obj.Names)
return_obj.intended_effects = \
[Statement.from_obj(x) for x in obj.Intended_Effect]
return_obj.status = VocabString.from_obj(obj.Status)
return_obj.related_ttps = RelatedTTPs.from_obj(obj.Related_TTPs)
return_obj.related_incidents = \
RelatedIncidents.from_obj(obj.Related_Incidents)
return_obj.related_indicators = \
RelatedIndicators.from_obj(obj.Related_Indicators)
return_obj.attribution = \
[Attribution.from_obj(x) for x in obj.Attribution]
return_obj.associated_campaigns = \
AssociatedCampaigns.from_obj(obj.Associated_Campaigns)
return_obj.confidence = Confidence.from_obj(obj.Confidence)
return_obj.activity = \
[Activity.from_obj(x) for x in obj.Activity]
return_obj.information_source = \
InformationSource.from_obj(obj.Information_Source)
return_obj.handling = Marking.from_obj(obj.Handling)
return_obj.related_packages = \
RelatedPackageRefs.from_obj(obj.Related_Packages)
return return_obj
def to_dict(self):
d = {}
if self.id_:
d['id'] = self.id_
if self.idref:
d['idref'] = self.idref
if self.timestamp:
d['timestamp'] = self.timestamp.isoformat()
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.names:
d['names'] = self.names.to_dict()
if self.intended_effects:
d['intended_effects'] = [x.to_dict() for x in self.intended_effects]
if self.status:
d['status'] = self.status.to_dict()
if self.related_ttps:
d['related_ttps'] = self.related_ttps.to_dict()
if self.related_incidents:
d['related_incidents'] = self.related_incidents.to_dict()
if self.related_indicators:
d['related_indicators'] = self.related_indicators.to_dict()
if self.attribution:
d['attribution'] = [x.to_dict() for x in self.attribution]
if self.associated_campaigns:
d['associated_campaigns'] = self.associated_campaigns.to_dict()
if self.confidence:
示例7: ThreatActor
# 需要导入模块: from stix.common.related import RelatedPackageRefs [as 别名]
# 或者: from stix.common.related.RelatedPackageRefs import to_dict [as 别名]
#.........这里部分代码省略.........
return return_obj
@classmethod
def from_obj(cls, obj, return_obj=None):
if not obj:
return None
if not return_obj:
return_obj = cls()
return_obj.id_ = obj.get_id()
return_obj.idref = obj.get_idref()
return_obj.timestamp = obj.get_timestamp()
if isinstance(obj, cls._binding_class): # ThreatActorType properties
return_obj.version = obj.get_version() if obj.get_version() else cls._version
return_obj.title = obj.get_Title()
return_obj.description = StructuredText.from_obj(obj.get_Description())
return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description())
return_obj.identity = Identity.from_obj(obj.get_Identity())
return_obj.type_ = [Statement.from_obj(x) for x in obj.get_Type()]
return_obj.motivation = [Statement.from_obj(x) for x in obj.get_Motivation()]
return_obj.sophistication = [Statement.from_obj(x) for x in obj.get_Sophistication()]
return_obj.intended_effect = [Statement.from_obj(x) for x in obj.get_Intended_Effect()]
return_obj.planning_and_operational_support = [Statement.from_obj(x) for x in obj.get_Planning_And_Operational_Support()]
return_obj.observed_ttps = ObservedTTPs.from_obj(obj.get_Observed_TTPs())
return_obj.associated_campaigns = AssociatedCampaigns.from_obj(obj.get_Associated_Campaigns())
return_obj.associated_actors = AssociatedActors.from_obj(obj.get_Associated_Actors())
return_obj.handling = Marking.from_obj(obj.get_Handling())
return_obj.confidence = Confidence.from_obj(obj.get_Confidence())
return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source())
return_obj.related_packages = RelatedPackageRefs.from_obj(obj.get_Related_Packages())
return return_obj
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.identity:
d['identity'] = self.identity.to_dict()
if self.type_:
d['type'] = [x.to_dict() for x in self.type_]
if self.motivation:
d['motivation'] = [x.to_dict() for x in self.motivation]
if self.sophistication:
d['sophistication'] = [x.to_dict() for x in self.sophistication]
if self.intended_effect:
d['intended_effect'] = [x.to_dict() for x in self.intended_effect]
if self.planning_and_operational_support:
d['planning_and_operational_support'] = [x.to_dict()
for x in self.planning_and_operational_support]
if self.observed_ttps:
d['observed_ttps'] = self.observed_ttps.to_dict()
if self.associated_campaigns:
d['associated_campaigns'] = self.associated_campaigns.to_dict()