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


Python Observable.to_dict方法代码示例

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


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

示例1: test_observables_property_composition

# 需要导入模块: from cybox.core import Observable [as 别名]
# 或者: from cybox.core.Observable import to_dict [as 别名]
    def test_observables_property_composition(self):
        f1 = File()
        f1.file_name = "README.txt"
        f2 = File()
        f2.file_name = "README2.txt"
        obs1 = Observable(f1)
        obs2 = Observable(f2)

        comp = Observable(ObservableComposition('AND', [obs1, obs2]))

        ind = Indicator()
        ind.observable = comp
        ind2 = Indicator.from_dict(ind.to_dict())
        self.assertEqual([obs1.to_dict(), obs2.to_dict()],
                         [x.to_dict() for x in ind2.observables])
开发者ID:santosomar,项目名称:python-stix,代码行数:17,代码来源:indicator_test.py

示例2: test_round_trip

# 需要导入模块: from cybox.core import Observable [as 别名]
# 或者: from cybox.core.Observable import to_dict [as 别名]
    def test_round_trip(self):
        o = Observable()
        o.title = "An observable"
        o.description = "some text"
        o.description.structuring_format = "plain"
        o.id_ = "abc123"
        o.object_ = Object()

        o2 = cybox.test.round_trip(o)
        self.assertEqual(o.to_dict(), o2.to_dict())
开发者ID:bauer1j,项目名称:python-cybox,代码行数:12,代码来源:observable_test.py

示例3: test_observables_property_standard

# 需要导入模块: from cybox.core import Observable [as 别名]
# 或者: from cybox.core.Observable import to_dict [as 别名]
    def test_observables_property_standard(self):
        f = File()
        f.file_name = "README.txt"
        obs = Observable(f)
        ind = Indicator()
        ind.observable = obs

        ind2 = Indicator.from_dict(ind.to_dict())

        self.assertEqual([obs.to_dict()],
                         [x.to_dict() for x in ind2.observables])
开发者ID:santosomar,项目名称:python-stix,代码行数:13,代码来源:indicator_test.py

示例4: test_round_trip_observable

# 需要导入模块: from cybox.core import Observable [as 别名]
# 或者: from cybox.core.Observable import to_dict [as 别名]
    def test_round_trip_observable(self):
        # Wrap the object in an observable before trying a round_trip test.

        # Don't run this test on the base class
        if type(self) == type(ObjectTestCase):
            return

        obj = self.klass.from_dict(self._full_dict)
        observable = Observable(obj)
        observable2 = cybox.test.round_trip(observable, output=True)
        self.maxDiff = None
        self.assertEqual(observable.to_dict(), observable2.to_dict())
开发者ID:aravindpfpt,项目名称:python-cybox,代码行数:14,代码来源:__init__.py

示例5: test_round_trip

# 需要导入模块: from cybox.core import Observable [as 别名]
# 或者: from cybox.core.Observable import to_dict [as 别名]
    def test_round_trip(self):
        o = Observable()
        o.title = "An observable"
        o.description = "some text"
        o.description.structuring_format = "plain"
        o.id_ = "abc123"
        o.object_ = Object()

        pf = PatternFidelity()
        ot = ObfuscationTechnique()
        ot.description = "X0Rz"
        pf.evasion_techniques = ObfuscationTechniques()
        pf.evasion_techniques.append(ot)
        o.pattern_fidelity = pf

        o2 = round_trip(o)
        self.assertEqual(o.to_dict(), o2.to_dict())
开发者ID:luisgf,项目名称:watsondt,代码行数:19,代码来源:observable_test.py


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