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


Python setools.TERuleQuery类代码示例

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


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

示例1: test_005_target_direct

    def test_005_target_direct(self):
        """TE rule query with exact, direct, target match."""
        q = TERuleQuery(self.p, target="test5a", target_indirect=False, target_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], "allow", "test5s", "test5a", "infoflow", set(["hi_w"]))
开发者ID:Zeirison,项目名称:setools,代码行数:7,代码来源:terulequery.py

示例2: test_007_target_direct_regex

    def test_007_target_direct_regex(self):
        """TE rule query with regex, direct, target match."""
        q = TERuleQuery(self.p, target="test7a.*", target_indirect=False, target_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], "allow", "test7s", "test7aPASS", "infoflow", set(["low_r"]))
开发者ID:Zeirison,项目名称:setools,代码行数:7,代码来源:terulequery.py

示例3: test_003_source_direct_regex

    def test_003_source_direct_regex(self):
        """TE rule query with regex, direct, source match."""
        q = TERuleQuery(self.p, source="test3a.*", source_indirect=False, source_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], "allow", "test3aS", "test3t", "infoflow", set(["low_r"]))
开发者ID:Zeirison,项目名称:setools,代码行数:7,代码来源:terulequery.py

示例4: test_100_default

    def test_100_default(self):
        """TE rule query with default type exact match."""
        q = TERuleQuery(self.p, default="test100d", default_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], TRT.type_transition, "test100", "test100", "infoflow7", "test100d")
开发者ID:TresysTechnology,项目名称:setools,代码行数:7,代码来源:terulequery.py

示例5: test_002_source_indirect

    def test_002_source_indirect(self):
        """TE rule query with exact, indirect, source match."""
        q = TERuleQuery(self.p, source="test2s", source_indirect=True, source_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], "allow", "test2a", "test2t", "infoflow", set(["hi_w"]))
开发者ID:Zeirison,项目名称:setools,代码行数:7,代码来源:terulequery.py

示例6: test_009_class

    def test_009_class(self):
        """TE rule query with exact object class match."""
        q = TERuleQuery(self.p, tclass="infoflow2", tclass_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], TRT.allow, "test9", "test9", "infoflow2", set(["super_w"]))
开发者ID:TresysTechnology,项目名称:setools,代码行数:7,代码来源:terulequery.py

示例7: test_010_class_list

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

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "allow", "test10", "test10", "infoflow3", set(["null"]))
        self.validate_rule(r[1], "allow", "test10", "test10", "infoflow4", set(["hi_w"]))
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例8: test_004_source_indirect_regex

    def test_004_source_indirect_regex(self):
        """TE rule query with regex, indirect, source match."""
        q = TERuleQuery(self.p, source="test4(s|t)", source_indirect=True, source_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "allow", "test4a1", "test4a1", "infoflow", set(["hi_w"]))
        self.validate_rule(r[1], "allow", "test4a2", "test4a2", "infoflow", set(["low_r"]))
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例9: test_011_class_regex

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

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "allowxperm", "test11", "test11", "infoflow5", set([0x1111]), xperm="ioctl")
        self.validate_rule(r[1], "allowxperm", "test11", "test11", "infoflow6", set([0x5555]), xperm="ioctl")
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例10: test_008_target_indirect_regex

    def test_008_target_indirect_regex(self):
        """Xperm rule query with regex, indirect, target match."""
        q = TERuleQuery(self.p, target="test8(s|t)", target_indirect=True, target_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "allowxperm", "test8a1", "test8a1", "infoflow", set([0x9999]), xperm="ioctl")
        self.validate_rule(r[1], "allowxperm", "test8a2", "test8a2", "infoflow", set([0x1111]), xperm="ioctl")
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例11: test_006_target_indirect

    def test_006_target_indirect(self):
        """Xperm rule query with exact, indirect, target match."""
        q = TERuleQuery(self.p, target="test6t", target_indirect=True, target_regex=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "allowxperm", "test6s", "test6a", "infoflow", set([0x9999]), xperm="ioctl")
        self.validate_rule(r[1], "allowxperm", "test6s", "test6t", "infoflow", set([0x1111]), xperm="ioctl")
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例12: test_014_ruletype

    def test_014_ruletype(self):
        """TE rule query with rule type match."""
        q = TERuleQuery(self.p, ruletype=["auditallow", "dontaudit"])

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "auditallow", "test14", "test14", "infoflow7", set(["super_both"]))
        self.validate_rule(r[1], "dontaudit", "test14", "test14", "infoflow7", set(["super_unmapped"]))
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例13: test_012_perms_any

    def test_012_perms_any(self):
        """TE rule query with permission set intersection."""
        q = TERuleQuery(self.p, perms=["super_r"], perms_equal=False)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "allow", "test12a", "test12a", "infoflow7", set(["super_r"]))
        self.validate_rule(r[1], "allow", "test12b", "test12b", "infoflow7", set(["super_r", "super_none"]))
开发者ID:Zeirison,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例14: test_011_class_regex

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

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], TRT.allow, "test11", "test11", "infoflow5", set(["low_w"]))
        self.validate_rule(r[1], TRT.allow, "test11", "test11", "infoflow6", set(["med_r"]))
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:terulequery.py

示例15: test_101_default_regex

    def test_101_default_regex(self):
        """TE rule query with default type regex match."""
        q = TERuleQuery(self.p, default="test101.", default_regex=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 2)
        self.validate_rule(r[0], "type_transition", "test101", "test101d", "infoflow7", "test101e")
        self.validate_rule(r[1], "type_transition", "test101", "test101e", "infoflow7", "test101d")
开发者ID:NightOfTwelve,项目名称:sedump,代码行数:8,代码来源:terulequery.py


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