当前位置: 首页>>代码示例>>Python>>正文


Python Indicator.from_obj方法代码示例

本文整理汇总了Python中stix.indicator.Indicator.from_obj方法的典型用法代码示例。如果您正苦于以下问题:Python Indicator.from_obj方法的具体用法?Python Indicator.from_obj怎么用?Python Indicator.from_obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stix.indicator.Indicator的用法示例。


在下文中一共展示了Indicator.from_obj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: from_obj

# 需要导入模块: from stix.indicator import Indicator [as 别名]
# 或者: from stix.indicator.Indicator import from_obj [as 别名]
    def from_obj(cls, obj, return_obj=None):
        if not return_obj:
            return_obj = cls()

        return_obj.id_ = obj.id
        return_obj.idref = obj.idref
        return_obj.timestamp = obj.timestamp
        return_obj.stix_header = STIXHeader.from_obj(obj.STIX_Header)
        return_obj.related_packages = RelatedPackages.from_obj(obj.Related_Packages)

        if obj.version:
            return_obj.version = obj.version
        if obj.Campaigns:
            return_obj.campaigns = [Campaign.from_obj(x) for x in obj.Campaigns.Campaign]
        if obj.Courses_Of_Action:
            return_obj.courses_of_action = [CourseOfAction.from_obj(x) for x in obj.Courses_Of_Action.Course_Of_Action]
        if obj.Exploit_Targets:
            return_obj.exploit_targets = [ExploitTarget.from_obj(x) for x in obj.Exploit_Targets.Exploit_Target]
        if obj.Indicators:
            return_obj.indicators = [Indicator.from_obj(x) for x in obj.Indicators.Indicator]
        if obj.Observables:
            return_obj.observables = Observables.from_obj(obj.Observables)
        if obj.Incidents:
            return_obj.incidents = [Incident.from_obj(x) for x in obj.Incidents.Incident]
        if obj.Threat_Actors:
            return_obj.threat_actors = [ThreatActor.from_obj(x) for x in obj.Threat_Actors.Threat_Actor]
        if obj.TTPs:
            return_obj.ttps = TTPs.from_obj(obj.TTPs)
            
        return return_obj
开发者ID:Seevil,项目名称:python-stix,代码行数:32,代码来源:stix_package.py

示例2: from_obj

# 需要导入模块: from stix.indicator import Indicator [as 别名]
# 或者: from stix.indicator.Indicator import from_obj [as 别名]
    def from_obj(cls, obj, return_obj=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()
        return_obj.stix_header = STIXHeader.from_obj(obj.get_STIX_Header())
        return_obj.related_packages = RelatedPackages.from_obj(obj.get_Related_Packages())

        if obj.get_version():
            return_obj.version = obj.get_version()
        if obj.get_Campaigns():
            return_obj.campaigns = [Campaign.from_obj(x) for x in obj.get_Campaigns().get_Campaign()]
        if obj.get_Courses_Of_Action():
            return_obj.courses_of_action = [CourseOfAction.from_obj(x) for x in obj.get_Courses_Of_Action().get_Course_Of_Action()]
        if obj.get_Exploit_Targets():
            return_obj.exploit_targets = [ExploitTarget.from_obj(x) for x in obj.get_Exploit_Targets().get_Exploit_Target()]
        if obj.get_Indicators():
            return_obj.indicators = [Indicator.from_obj(x) for x in obj.get_Indicators().get_Indicator()]
        if obj.get_Observables():
            return_obj.observables = Observables.from_obj(obj.get_Observables())
        if obj.get_Incidents():
            return_obj.incidents = [Incident.from_obj(x) for x in obj.get_Incidents().get_Incident()]
        if obj.get_Threat_Actors():
            return_obj.threat_actors = [ThreatActor.from_obj(x) for x in obj.get_Threat_Actors().get_Threat_Actor()]
        if obj.get_TTPs():
            return_obj.ttps = TTPs.from_obj(obj.get_TTPs())
            
        return return_obj
开发者ID:SYNchroACK,项目名称:crits_dependencies,代码行数:32,代码来源:stix_package.py

示例3: from_obj

# 需要导入模块: from stix.indicator import Indicator [as 别名]
# 或者: from stix.indicator.Indicator import from_obj [as 别名]
 def from_obj(cls, obj, return_obj=None):
     if not return_obj:
         return_obj = cls()
         
     return_obj.id_ = obj.get_id()
     return_obj.idref_ = obj.get_idref()
     return_obj.version = obj.get_version()
     return_obj.stix_header = STIXHeader.from_obj(obj.get_STIX_Header())
     
     if obj.get_Indicators():
         indicators_obj = obj.get_Indicators()
         if indicators_obj.get_Indicator():
             for indicator_obj in indicators_obj.get_Indicator():
                 return_obj.add_indicator(Indicator.from_obj(indicator_obj))
     
     return return_obj
开发者ID:2xyo,项目名称:python-stix,代码行数:18,代码来源:stix_package.py


注:本文中的stix.indicator.Indicator.from_obj方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。