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


Python StructuredText.from_obj方法代码示例

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


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

示例1: from_obj

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

        if not return_obj:
            raise ValueError("Must provide a return_obj argument")

        if not obj:
            raise ValueError("Must provide an obj argument")

        return_obj.id_ = obj.id
        return_obj.idref = obj.idref
        return_obj.timestamp = obj.timestamp

        # These may not be found on the input obj if it isn't a full
        # type definition (e.g., used as a reference)
        return_obj.version = getattr(obj, 'version', None)
        return_obj.title = getattr(obj, 'Title', None)
        return_obj.description = \
            StructuredText.from_obj(getattr(obj, 'Description', None))
        return_obj.short_description = \
            StructuredText.from_obj(getattr(obj, 'Short_Description', None))
        return_obj.information_source = \
            InformationSource.from_obj(getattr(obj, 'Information_Source', None))

        return return_obj
开发者ID:andybarilla,项目名称:python-stix,代码行数:27,代码来源:base.py

示例2: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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
开发者ID:Seevil,项目名称:python-stix,代码行数:33,代码来源:__init__.py

示例3: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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): # 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.behavior = Behavior.from_obj(obj.Behavior)
            return_obj.related_ttps = RelatedTTPs.from_obj(obj.Related_TTPs)
            return_obj.exploit_targets = ExploitTargets.from_obj(obj.Exploit_Targets)
            return_obj.information_source = InformationSource.from_obj(obj.Information_Source)
            return_obj.resources = Resource.from_obj(obj.Resources)
            return_obj.victim_targeting = VictimTargeting.from_obj(obj.Victim_Targeting)
            return_obj.handling = Marking.from_obj(obj.Handling)

            if obj.Intended_Effect:
                return_obj.intended_effects = [Statement.from_obj(x) for x in obj.Intended_Effect]

        return return_obj
开发者ID:DavidWatersHub,项目名称:python-stix,代码行数:29,代码来源:__init__.py

示例4: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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): # CourseOfActionType properties
            return_obj.version = obj.get_version() or cls._version
            return_obj.title = obj.get_Title()
            return_obj.stage = VocabString.from_obj(obj.get_Stage())
            return_obj.type_ = VocabString.from_obj(obj.get_Type())
            return_obj.description = StructuredText.from_obj(obj.get_Description())
            return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description())
            return_obj.objective = Objective.from_obj(obj.get_Objective())
            return_obj.parameter_observables = \
                    Observables.from_obj(obj.get_Parameter_Observables())
            return_obj.impact = Statement.from_obj(obj.get_Impact())
            return_obj.cost = Statement.from_obj(obj.get_Cost())
            return_obj.efficacy = Statement.from_obj(obj.get_Efficacy())
            return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source())
            return_obj.handling = Marking.from_obj(obj.get_Handling())
            return_obj.related_coas = \
                    RelatedCOAs.from_obj(obj.get_Related_COAs())
            return_obj.related_packages = \
                    RelatedPackageRefs.from_obj(obj.get_Related_Packages())

        return return_obj
开发者ID:chongkim,项目名称:python-stix,代码行数:33,代码来源:__init__.py

示例5: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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.behavior = Behavior.from_obj(obj.get_Behavior())
            return_obj.related_ttps = RelatedTTPs.from_obj(obj.get_Related_TTPs())
            return_obj.information_source = InformationSource.from_obj(obj.get_Information_Source())
            return_obj.resources = Resource.from_obj(obj.get_Resources())
            return_obj.victim_targeting = VictimTargeting.from_obj(obj.get_Victim_Targeting())

            if obj.get_Intended_Effect():
                return_obj.intended_effects = [Statement.from_obj(x) for x in obj.get_Intended_Effect()]

        return return_obj
开发者ID:mgoldsborough,项目名称:python-stix,代码行数:27,代码来源:__init__.py

示例6: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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.types = [Statement.from_obj(x) for x in obj.get_Type()]
            return_obj.motivations = [Statement.from_obj(x) for x in obj.get_Motivation()]
            return_obj.sophistications = [Statement.from_obj(x) for x in obj.get_Sophistication()]
            return_obj.intended_effects = [Statement.from_obj(x) for x in obj.get_Intended_Effect()]
            return_obj.planning_and_operational_supports = [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
开发者ID:SYNchroACK,项目名称:crits_dependencies,代码行数:31,代码来源:__init__.py

示例7: from_obj

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

        return_obj.description = StructuredText.from_obj(obj.get_Description())
        return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description())
        return_obj.applicability_confidence = Confidence.from_obj(obj.get_Applicability_Confidence())
        return return_obj
开发者ID:SYNchroACK,项目名称:crits_dependencies,代码行数:12,代码来源:objective.py

示例8: from_obj

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

        return_obj.title = obj.get_Title()
        return_obj.cce_id = obj.get_CCE_ID()
        return_obj.description = StructuredText.from_obj(obj.get_Description())
        return_obj.short_description = StructuredText.from_obj(obj.get_Short_Description())
        return return_obj
开发者ID:mgoldsborough,项目名称:python-stix,代码行数:13,代码来源:configuration.py

示例9: from_obj

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

        return_obj.description = StructuredText.from_obj(obj.Description)
        return_obj.short_description = StructuredText.from_obj(obj.Short_Description)
        return_obj.cce_id = obj.CCE_ID

        return return_obj
开发者ID:Seevil,项目名称:python-stix,代码行数:13,代码来源:configuration.py

示例10: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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):
            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.time = Time.from_obj(obj.Time)
    
            if obj.Victim:
                return_obj.victims = [Identity.from_obj(x) for x in obj.Victim]
            if obj.Categories:
                return_obj.categories = [IncidentCategory.from_obj(x) for x in obj.Categories.Category]
            if obj.Intended_Effect:
                return_obj.intended_effects = [Statement.from_obj(x) for x in obj.Intended_Effect]
            if obj.Affected_Assets:
                return_obj.affected_assets = [AffectedAsset.from_obj(x) for x in obj.Affected_Assets.Affected_Asset]
            if obj.Discovery_Method:
                return_obj.discovery_methods = [DiscoveryMethod.from_obj(x) for x in obj.Discovery_Method]
            if obj.Reporter:
                return_obj.reporter = InformationSource.from_obj(obj.Reporter)
            if obj.Responder:
                return_obj.responders = [InformationSource.from_obj(x) for x in obj.Responder]
            if obj.Coordinator:
                return_obj.coordinators = [InformationSource.from_obj(x) for x in obj.Coordinator]
            if obj.External_ID:
                return_obj.external_ids = [ExternalID.from_obj(x) for x in obj.External_ID]
            if obj.Impact_Assessment:
                return_obj.impact_assessment = ImpactAssessment.from_obj(obj.Impact_Assessment)
            if obj.Information_Source:
                return_obj.information_source = InformationSource.from_obj(obj.Information_Source)
            if obj.Security_Compromise:
                return_obj.security_compromise = SecurityCompromise.from_obj(obj.Security_Compromise)
            
            return_obj.coa_taken = [COATaken.from_obj(x) for x in obj.COA_Taken]
            return_obj.confidence = Confidence.from_obj(obj.Confidence)
            return_obj.attributed_threat_actors = AttributedThreatActors.from_obj(obj.Attributed_Threat_Actors)
            return_obj.related_indicators = RelatedIndicators.from_obj(obj.Related_Indicators)
            return_obj.related_observables = RelatedObservables.from_obj(obj.Related_Observables)
            return_obj.leveraged_ttps = LeveragedTTPs.from_obj(obj.Leveraged_TTPs)
            return_obj.related_incidents = RelatedIncidents.from_obj(obj.Related_Incidents)
            return_obj.status = VocabString.from_obj(obj.Status)
            return_obj.handling = Marking.from_obj(obj.Handling)
            return_obj.history = History.from_obj(obj.History)
            
        return return_obj
开发者ID:VerSprite,项目名称:python-stix,代码行数:56,代码来源:__init__.py

示例11: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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.title = obj.Title
        return_obj.description = StructuredText.from_obj(obj.Description)
        return_obj.short_description = StructuredText.from_obj(obj.Short_Description)

        return return_obj
开发者ID:andybarilla,项目名称:python-stix,代码行数:14,代码来源:exploit.py

示例12: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
 def from_obj(cls, obj, return_obj=None):
     if not obj:
         return None
     if return_obj is None:
         return_obj = cls()
     
     return_obj.timestamp = obj.get_timestamp()
     return_obj.timestamp_precision = obj.get_timestamp_precision()
     return_obj.source = StructuredText.from_obj(obj.get_Source())
     return_obj.refernce = obj.get_Reference()
     return_obj.confidence = Confidence.from_obj(obj.get_Confidence())
     return_obj.description = StructuredText.from_obj(obj.get_Description())
     return_obj.related_observables = RelatedObservables.from_obj(obj.get_Related_Observables())
     return return_obj
开发者ID:mgoldsborough,项目名称:python-stix,代码行数:16,代码来源:sightings.py

示例13: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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.title = obj.Title
        return_obj.description = StructuredText.from_obj(obj.Description)
        return_obj.short_description = StructuredText.from_obj(obj.Short_Description)
        return_obj.observable_characterization = Observables.from_obj(obj.Observable_Characterization)

        if obj.Type:
            return_obj.types = [VocabString.from_obj(x) for x in obj.Type]

        return return_obj
开发者ID:Seevil,项目名称:python-stix,代码行数:18,代码来源:infrastructure.py

示例14: from_obj

# 需要导入模块: from stix.common import StructuredText [as 别名]
# 或者: from stix.common.StructuredText import from_obj [as 别名]
    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.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.observable_characterization = Observables.from_obj(obj.get_Observable_Characterization())

        if obj.get_Type():
            return_obj.types = [AttackerInfrastructureType.from_obj(x) for x in obj.get_Type()]

        return return_obj
开发者ID:mgoldsborough,项目名称:python-stix,代码行数:18,代码来源:infrastructure.py

示例15: from_obj

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

        return_obj.type_ = AssetType.from_obj(obj.Type)
        return_obj.description = StructuredText.from_obj(obj.Description)
        return_obj.business_function_or_role = StructuredText.from_obj(obj.Business_Function_Or_Role)
        return_obj.ownership_class = VocabString.from_obj(obj.Ownership_Class)
        return_obj.management_class = VocabString.from_obj(obj.Management_Class)
        return_obj.location_class = VocabString.from_obj(obj.Location_Class)
        #return_obj.location = None 
        
        if obj.Nature_Of_Security_Effect:
            n = obj.Nature_Of_Security_Effect
            return_obj.nature_of_security_effect = [PropertyAffected.from_obj(x) for x in n.Property_Affected]
        return return_obj
开发者ID:DavidWatersHub,项目名称:python-stix,代码行数:20,代码来源:affected_asset.py


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