• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python setools.MLSRuleQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_045_range_proper_superset2

    def test_045_range_proper_superset2(self):
        """MLS rule query with context range proper superset match (equal)"""
        q = MLSRuleQuery(self.p,
                         default="s45:c1 - s45:c1.c3", default_superset=True, default_proper=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 0)
开发者ID:TresysTechnology,项目名称:setools,代码行数:7,代码来源:mlsrulequery.py


示例2: test_020_class

    def test_020_class(self):
        """MLS rule query with exact object class match."""
        q = MLSRuleQuery(self.p, tclass="infoflow7", tclass_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test20", "test20", "infoflow7", "s1")
开发者ID:TresysTechnology,项目名称:setools,代码行数:7,代码来源:mlsrulequery.py


示例3: test_012_target_direct_regex

    def test_012_target_direct_regex(self):
        """MLS rule query with regex, direct, target match."""
        q = MLSRuleQuery(
            self.p, target="test12a.*", target_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test12s", "test12aFAIL", "infoflow", "s2")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例4: test_001_source_direct

    def test_001_source_direct(self):
        """MLS rule query with exact, direct, source match."""
        q = MLSRuleQuery(
            self.p, source="test1s", source_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test1s", "test1t", "infoflow", "s0")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例5: test_044_range_proper_subset1

    def test_044_range_proper_subset1(self):
        """MLS rule query with context range proper subset match"""
        q = MLSRuleQuery(self.p, default="s44:c1,c2", default_subset=True, default_proper=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test44", "test44", "infoflow",
                           "s44:c1 - s44:c1.c3")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例6: test_043_range_superset2

    def test_043_range_superset2(self):
        """MLS rule query with context range superset match (equal)"""
        q = MLSRuleQuery(self.p, default="s43:c1 - s43:c1.c3", default_superset=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test43", "test43", "infoflow",
                           "s43:c1 - s43:c1.c3")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例7: test_042_range_subset1

    def test_042_range_subset1(self):
        """MLS rule query with context range subset match"""
        q = MLSRuleQuery(self.p, default="s42:c1,c2 - s42:c0.c3", default_overlap=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test42", "test42", "infoflow",
                           "s42:c1 - s42:c1.c3")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例8: test_041_range_overlap5

    def test_041_range_overlap5(self):
        """MLS rule query with context range overlap match (overlap high level)"""
        q = MLSRuleQuery(self.p, default="s41:c1,c2 - s41:c0.c4", default_overlap=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test41", "test41", "infoflow",
                           "s41:c1 - s41:c1.c3")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例9: test_040_range_exact

    def test_040_range_exact(self):
        """MLS rule query with context range exact match"""
        q = MLSRuleQuery(self.p, default="s40:c1 - s40:c0.c4")

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], RT.range_transition, "test40", "test40", "infoflow",
                           "s40:c1 - s40:c0.c4")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例10: test_022_class_regex

    def test_022_class_regex(self):
        """MLS rule query with object class regex match."""
        q = MLSRuleQuery(self.p, tclass="infoflow(5|6)", tclass_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], RT.range_transition, "test22", "test22", "infoflow5", "s1")
        self.validate_rule(r[1], RT.range_transition, "test22", "test22", "infoflow6", "s2")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:mlsrulequery.py


示例11: test_014_issue111

    def test_014_issue111(self):
        """MLS rule query with attribute target criteria, indirect match."""
        # https://github.com/TresysTechnology/setools/issues/111
        q = MLSRuleQuery(self.p, target="test14b", target_indirect=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], RT.range_transition, "test14source", "test14t1", "infoflow", "s1")
        self.validate_rule(r[1], RT.range_transition, "test14source", "test14t2", "infoflow7", "s2")
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:mlsrulequery.py


示例12: test_010_target_direct

    def test_010_target_direct(self):
        """MLS rule query with exact, direct, target match."""
        q = MLSRuleQuery(
            self.p, target="test10t", target_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], RT.range_transition, "test10s", "test10t", "infoflow", "s0")
        self.validate_rule(r[1], RT.range_transition, "test10s", "test10t", "infoflow2", "s1")
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:mlsrulequery.py


示例13: test_003_source_direct_regex

    def test_003_source_direct_regex(self):
        """MLS rule query with regex, direct, source match."""
        q = MLSRuleQuery(
            self.p, source="test3(s|aS)", source_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], RT.range_transition, "test3s", "test3t", "infoflow", "s1")
        self.validate_rule(r[1], RT.range_transition, "test3s", "test3t", "infoflow2", "s2")
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:mlsrulequery.py


示例14: test_000_unset

    def test_000_unset(self):
        """MLS rule query with no criteria."""
        # query with no parameters gets all MLS rules.
        rules = sorted(self.p.mlsrules())

        q = MLSRuleQuery(self.p)
        q_rules = sorted(q.results())

        self.assertListEqual(rules, q_rules)
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:mlsrulequery.py


示例15: test_021_class_list

    def test_021_class_list(self):
        """MLS rule query with object class list match."""
        q = MLSRuleQuery(
            self.p, tclass=["infoflow3", "infoflow4"], tclass_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], RT.range_transition, "test21", "test21", "infoflow3", "s2")
        self.validate_rule(r[1], RT.range_transition, "test21", "test21", "infoflow4", "s1")
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:mlsrulequery.py


示例16: test_045_range_proper_superset4

    def test_045_range_proper_superset4(self):
        """MLS rule query with context range proper superset match (equal high)"""
        q = MLSRuleQuery(self.p,
                         default="s45 - s45:c1.c3", default_superset=True, default_proper=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], "range_transition", "test45", "test45", "infoflow",
                           "s45:c1 - s45:c1.c3")
开发者ID:GitForNeo,项目名称:setools,代码行数:9,代码来源:mlsrulequery.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python setools.NodeconQuery类代码示例发布时间:2022-05-27
下一篇:
Python setools.IoportconQuery类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap