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

Python setools.TERuleQuery类代码示例

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

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



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


示例16: test_101_xperm_equal

    def test_101_xperm_equal(self):
        """Xperm rule query match equal perm set."""
        q = TERuleQuery(self.p, xperms=[(0x9011, 0x9013)], xperms_equal=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], TRT.allowxperm, "test101c", "test101c", "infoflow7",
                           set([0x9011, 0x9012, 0x9013]), xperm="ioctl")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:terulequery.py


示例17: test_201_boolean_equal

    def test_201_boolean_equal(self):
        """TE rule query with equal Boolean set match."""
        q = TERuleQuery(self.p, boolean=["test201a", "test201b"], boolean_equal=True)

        r = sorted(q.results())
        self.assertEqual(len(r), 1)
        self.validate_rule(r[0], TRT.allow, "test201t1", "test201t1", "infoflow7",
                           set(["super_unmapped"]), cond="test201b && test201a")
开发者ID:TresysTechnology,项目名称:setools,代码行数:8,代码来源:terulequery.py


示例18: test_006_target_indirect

    def test_006_target_indirect(self):
        """TE 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], TRT.allow, "test6s", "test6a", "infoflow", set(["hi_w"]))
        self.validate_rule(r[1], TRT.allow, "test6s", "test6t", "infoflow", set(["low_r"]))
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:terulequery.py


示例19: test_100_std_perm_equal

    def test_100_std_perm_equal(self):
        """Xperm rule query match by standard permission, equal perm set."""
        q = TERuleQuery(self.p, ruletype=["neverallow", "neverallowxperm"],
                        perms=set(["ioctl", "hi_w"]), perms_equal=True)

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


示例20: test_007_target_direct_regex

    def test_007_target_direct_regex(self):
        """Xperm 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], TRT.allowxperm, "test7s", "test7aPASS", "infoflow", set([0x1111]),
                           xperm="ioctl")
开发者ID:TresysTechnology,项目名称:setools,代码行数:9,代码来源:terulequery.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python setproctitle.getproctitle函数代码示例发布时间:2022-05-27
下一篇:
Python setools.PortconQuery类代码示例发布时间: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