當前位置: 首頁>>代碼示例>>Python>>正文


Python setools.MLSRuleQuery類代碼示例

本文整理匯總了Python中setools.MLSRuleQuery的典型用法代碼示例。如果您正苦於以下問題:Python MLSRuleQuery類的具體用法?Python MLSRuleQuery怎麽用?Python MLSRuleQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了MLSRuleQuery類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的setools.MLSRuleQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。