Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /lib64/python3.9/site-packages/setools/
Upload File :
Current File : //lib64/python3.9/site-packages/setools/polcapquery.py

# Copyright 2014-2015, Tresys Technology, LLC
#
# SPDX-License-Identifier: LGPL-2.1-only
#
import logging
from typing import Iterable

from .mixins import MatchName
from .policyrep import PolicyCapability
from .query import PolicyQuery


class PolCapQuery(MatchName, PolicyQuery):

    """
    Query SELinux policy capabilities

    Parameter:
    policy      The policy to query.

    Keyword Parameters/Class attributes:
    name        The name of the policy capability to match.
    name_regex  If true, regular expression matching will
                be used for matching the name.
    """

    def __init__(self, policy, **kwargs) -> None:
        super(PolCapQuery, self).__init__(policy, **kwargs)
        self.log = logging.getLogger(__name__)

    def results(self) -> Iterable[PolicyCapability]:
        """Generator which yields all matching policy capabilities."""
        self.log.info("Generating policy capability results from {0.policy}".format(self))
        self._match_name_debug(self.log)

        for cap in self.policy.polcaps():
            if not self._match_name(cap):
                continue

            yield cap

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat