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


Python common.StructuredText类代码示例

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


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

示例1: test_round_trip

    def test_round_trip(self):
        text = StructuredText()
        text.value = "some text"
        text.structuring_format = "plain"

        text2 = cybox.test.round_trip(text)
        self.assertEqual(text.to_dict(), text2.to_dict())
开发者ID:luisgf,项目名称:watsondt,代码行数:7,代码来源:structured_test_text.py

示例2: test_plain

    def test_plain(self):
        text = StructuredText.from_dict("a string")

        text2 = cybox.test.round_trip(text)
        self.assertEqual(text.to_dict(), text2.to_dict())

        text_dict = {'value': "a string"}
        text3 = StructuredText.from_dict(text_dict)

        self.assertEqual(text.to_dict(), text3.to_dict())
开发者ID:luisgf,项目名称:watsondt,代码行数:10,代码来源:structured_test_text.py

示例3: from_dict

 def from_dict(platform_specification_dict):
     if not platform_specification_dict:
         return None
     platform_specification_ = PlatformSpecification()
     platform_specification_.description = StructuredText.from_dict(platform_specification_dict.get('description'))
     platform_specification_.identifiers = [PlatformIdentifier.from_dict(x) for x in platform_specification_dict.get('identifiers',[])]
     return platform_specification_
开发者ID:ChrisNolan1992,项目名称:python-cybox,代码行数:7,代码来源:platform_specification.py

示例4: from_obj

 def from_obj(platform_specification_obj):
     if not platform_specification_obj:
         return None
     platform_specification_ = PlatformSpecification()
     platform_specification_.description = StructuredText.from_obj(platform_specification_obj.get_Description())
     platform_specification_.identifiers = [PlatformIdentifier.from_obj(x) for x in platform_specification_obj.get_Identifier()]
     return platform_specification_
开发者ID:ChrisNolan1992,项目名称:python-cybox,代码行数:7,代码来源:platform_specification.py

示例5: test_description_output

    def test_description_output(self):
        incident = incident_binding.IncidentType()

        assets = incident_binding.AffectedAssetsType()
        asset = incident_binding.AffectedAssetType()

        description = StructuredText("A Description")
        asset.Structured_Description = description.to_obj()

        assets.add_Affected_Asset(asset)
        incident.Affected_Assets = assets

        s = StringIO.StringIO()

        incident.export(s.write, 0, {'http://stix.mitre.org/Incident-1': 'incident'})
        xml = s.getvalue()
        self.assertTrue("A Description" in xml, "Description not exported")
开发者ID:andybarilla,项目名称:python-stix,代码行数:17,代码来源:incident_test.py

示例6: from_obj

    def from_obj(observable_obj):
        if not observable_obj:
            return None

        obs = Observable()

        obs.id_ = observable_obj.get_id()
        obs.title = observable_obj.get_Title()
        obs.description = StructuredText.from_obj(observable_obj.get_Description())
        obs.object_ = Object.from_obj(observable_obj.get_Object())
        obs.observable_composition = ObservableComposition.from_obj(observable_obj.get_Observable_Composition())
        obs.idref = observable_obj.get_idref()
        return obs
开发者ID:maurakilleen,项目名称:crits_dependencies,代码行数:13,代码来源:observable.py

示例7: from_dict

    def from_dict(observable_dict):
        if not observable_dict:
            return None

        obs = Observable()

        obs.id_ = observable_dict.get('id')
        obs.title = observable_dict.get('title')
        obs.description = StructuredText.from_dict(observable_dict.get('description'))
        obs.object_ = Object.from_dict(observable_dict.get('object'))
        obs.observable_composition = ObservableComposition.from_dict(observable_dict.get('observable_composition'))
        obs.idref = observable_dict.get('idref')

        return obs
开发者ID:maurakilleen,项目名称:crits_dependencies,代码行数:14,代码来源:observable.py

示例8: from_dict

 def from_dict(measure_source_dict):
     if not measure_source_dict:
         return None
     measure_source_ = MeasureSource()
     measure_source_.class_ = measure_source_dict.get('class')
     measure_source_.source_type = measure_source_dict.get('source_type')
     measure_source_.name = measure_source_dict.get('name')
     measure_source_.information_source_type = VocabString.from_dict(measure_source_dict.get('information_source_type'))
     measure_source_.tool_type = VocabString.from_dict(measure_source_dict.get('tool_type'))
     measure_source_.description = StructuredText.from_dict(measure_source_dict.get('description'))
     measure_source_.contributors = Personnel.from_list(measure_source_dict.get('contributors'))
     measure_source_.time = Time.from_dict(measure_source_dict.get('time'))
     measure_source_.tools = ToolInformationList.from_list(measure_source_dict.get('tools'))
     measure_source_.platform = None #TODO: add support
     measure_source_.system = ObjectProperties.from_dict(measure_source_dict.get('system'))
     measure_source_.instance = ObjectProperties.from_dict(measure_source_dict.get('instance'))
     return measure_source_
开发者ID:maurakilleen,项目名称:crits_dependencies,代码行数:17,代码来源:measuresource.py

示例9: from_obj

    def from_obj(observable_obj):
        if not observable_obj:
            return None

        obs = Observable()

        obs.id_ = observable_obj.get_id()
        obs.title = observable_obj.get_Title()
        obs.description = StructuredText.from_obj(observable_obj.get_Description())
        obs.object_ = Object.from_obj(observable_obj.get_Object())
        obs.event = Event.from_obj(observable_obj.get_Event())
        obs.observable_composition = ObservableComposition.from_obj(observable_obj.get_Observable_Composition())
        obs.idref = observable_obj.get_idref()
        obs.sighting_count = observable_obj.get_sighting_count()
        if observable_obj.get_Observable_Source():
            obs.observable_source = [MeasureSource.from_obj(x) for x in observable_obj.get_Observable_Source()]
        return obs
开发者ID:ajnelson,项目名称:python-cybox,代码行数:17,代码来源:observable.py

示例10: from_obj

 def from_obj(measure_source_obj):
     if not measure_source_obj:
         return None
     measure_source_ = MeasureSource()
     measure_source_.class_ = measure_source_obj.get_class()
     measure_source_.source_type = measure_source_obj.get_source_type()
     measure_source_.name = measure_source_obj.get_name()
     measure_source_.information_source_type = VocabString.from_obj(measure_source_obj.get_Information_Source_Type())
     measure_source_.tool_type = VocabString.from_obj(measure_source_obj.get_Tool_Type())
     measure_source_.description = StructuredText.from_obj(measure_source_obj.get_Description())
     measure_source_.contributors = Personnel.from_obj(measure_source_obj.get_Contributors())
     measure_source_.time = Time.from_obj(measure_source_obj.get_Time())
     measure_source_.tools = ToolInformationList.from_obj(measure_source_obj.get_Tools())
     measure_source_.platform = None #TODO: add support
     measure_source_.system = ObjectProperties.from_obj(measure_source_obj.get_System())
     measure_source_.instance = ObjectProperties.from_obj(measure_source_obj.get_Instance())
     return measure_source_
开发者ID:maurakilleen,项目名称:crits_dependencies,代码行数:17,代码来源:measuresource.py

示例11: from_dict

    def from_dict(observable_dict):
        if not observable_dict:
            return None

        obs = Observable()

        obs.id_ = observable_dict.get('id')
        obs.title = observable_dict.get('title')
        obs.description = StructuredText.from_dict(observable_dict.get('description'))
        obs.object_ = Object.from_dict(observable_dict.get('object'))
        obs.event = Object.from_dict(observable_dict.get('event'))
        obs.observable_composition = ObservableComposition.from_dict(observable_dict.get('observable_composition'))
        obs.idref = observable_dict.get('idref')
        obs.sighting_count = observable_dict.get('sighting_count')
        if observable_dict.get('observable_source'):
            obs.observable_source = [MeasureSource.from_dict(x) for x in observable_dict.get('observable_source')]

        return obs
开发者ID:ajnelson,项目名称:python-cybox,代码行数:18,代码来源:observable.py

示例12: from_obj

    def from_obj(toolinfo_obj, tool_class = None):
        if not toolinfo_obj:
            return None
        if not tool_class:
            toolinfo = ToolInformation()
        else:
            toolinfo = tool_class
        toolinfo.id_ = toolinfo_obj.get_id()
        toolinfo.idref = toolinfo_obj.get_idref()
        toolinfo.name = toolinfo_obj.get_Name()
        toolinfo.type_ = [ToolType.from_obj(x) for x in toolinfo_obj.get_Type()]
        toolinfo.description = StructuredText.from_obj(toolinfo_obj.get_Description())

        toolinfo.vendor = toolinfo_obj.get_Vendor()
        toolinfo.version = toolinfo_obj.get_Version()
        toolinfo.service_pack = toolinfo_obj.get_Service_Pack()

        toolinfo.tool_hashes = HashList.from_obj(toolinfo_obj.get_Tool_Hashes())

        return toolinfo
开发者ID:ChrisNolan1992,项目名称:python-cybox,代码行数:20,代码来源:tools.py

示例13: from_obj

    def from_obj(toolinfo_obj, toolinfo=None):
        if not toolinfo_obj:
            return None

        if not toolinfo:
            toolinfo = ToolInformation()

        toolinfo.id_ = toolinfo_obj.id
        toolinfo.idref = toolinfo_obj.idref
        toolinfo.name = toolinfo_obj.Name
        toolinfo.type_ = [VocabString.from_obj(x) for x in toolinfo_obj.Type]
        toolinfo.description = StructuredText.from_obj(toolinfo_obj.Description)

        toolinfo.vendor = toolinfo_obj.Vendor
        toolinfo.version = toolinfo_obj.Version
        toolinfo.service_pack = toolinfo_obj.Service_Pack

        toolinfo.tool_hashes = HashList.from_obj(toolinfo_obj.Tool_Hashes)

        return toolinfo
开发者ID:pallav17,项目名称:python-cybox,代码行数:20,代码来源:tools.py

示例14: from_dict

    def from_dict(toolinfo_dict, toolinfo=None):
        if not toolinfo_dict:
            return None

        if not toolinfo:
            toolinfo = ToolInformation()

        toolinfo.id_ = toolinfo_dict.get('id')
        toolinfo.idref = toolinfo_dict.get('idref')
        toolinfo.name = toolinfo_dict.get('name')
        toolinfo.type_ = [VocabString.from_dict(x) for x in toolinfo_dict.get('type', [])]
        toolinfo.description = StructuredText.from_dict(toolinfo_dict.get('description'))

        toolinfo.vendor = toolinfo_dict.get('vendor')
        toolinfo.version = toolinfo_dict.get('version')
        toolinfo.service_pack = toolinfo_dict.get('service_pack')

        toolinfo.tool_hashes = HashList.from_list(toolinfo_dict.get('tool_hashes'))

        return toolinfo
开发者ID:pallav17,项目名称:python-cybox,代码行数:20,代码来源:tools.py

示例15: from_dict

    def from_dict(observable_dict):
        if not observable_dict:
            return None

        from cybox.core import PatternFidelity
        obs = Observable()

        obs.id_ = observable_dict.get('id')
        obs.title = observable_dict.get('title')
        obs.description = StructuredText.from_dict(observable_dict.get('description'))
        obs.object_ = Object.from_dict(observable_dict.get('object'))
        obs.event = Object.from_dict(observable_dict.get('event'))
        obs.observable_composition = ObservableComposition.from_dict(observable_dict.get('observable_composition'))
        obs.idref = observable_dict.get('idref')
        obs.sighting_count = observable_dict.get('sighting_count')
        if observable_dict.get('observable_source'):
            obs.observable_source = [MeasureSource.from_dict(x) for x in observable_dict.get('observable_source')]
        obs.keywords = Keywords.from_dict(observable_dict.get('keywords'))
        obs.pattern_fidelity = PatternFidelity.from_dict(observable_dict.get('pattern_fidelity'))

        return obs
开发者ID:luisgf,项目名称:watsondt,代码行数:21,代码来源:observable.py


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