Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /usr/lib64/python3.9/site-packages/setools/__pycache__/
Dosya Yükle :
Şuanki Dosya : //usr/lib64/python3.9/site-packages/setools/__pycache__/util.cpython-39.pyc

a

q�qe]�@sddlmZddlmZmZmZmZddlmZm	Z	ddl
mZmZm
Z
eed�dd�Zeed	�d
d�Zeed�dd
�Zeeed�dd�Zeeed�dd�Zeeeeed�dd�Zeeeeeed�dd�Zd"eeeeeee
dd�dd�Zd#eeeeeefd�d d!�ZdS)$�)�suppress)�Iterable�List�Optional�Tuple�)�InvalidPermission�NoCommon)�Level�ObjClass�
SELinuxPolicy)�regex�returncCs"|rt|�t|���S||kSdS)z�
    Match the object with optional regular expression.

    Parameters:
    obj         The object to match.
    criteria    The criteria to match.
    regex       If regular expression matching should be used.
    N)�bool�search�str��obj�criteriar
�r�2/usr/lib64/python3.9/site-packages/setools/util.py�match_regex
s
r)�equalrcCs|r||kSt|�|��SdS)a
    Match the object (a set) with optional set equality.

    Parameters:
    obj         The object to match. (a set)
    criteria    The criteria to match. (a set)
    equal       If set equality should be used. Otherwise
                any set intersection will match.
    N)r�intersection)rrrrrr�	match_setsrcs&|rt�fdd�|D��S�|vSdS)z�
    Match if the criteria is in the list, with optional
    regular expression matching.

    Parameters:
    obj         The object to match.
    criteria    The criteria to match.
    regex       If regular expression matching should be used.
    csg|]}��t|��r|�qSr�rr��.0�m�rrr�
<listcomp>:�z match_in_set.<locals>.<listcomp>N)rrrrr�match_in_set.sr")�indirectr
rcsN|r>|r"t�fdd�|��D��Stt�����|����Snt|�|�SdS)aK
    Match the object with optional regular expression and indirection.

    Parameters:
    obj         The object to match.
    criteria    The criteria to match.
    regex       If regular expression matching should be used.
    indirect    If object indirection should be used, e.g.
                expanding an attribute.
    csg|]}��t|��r|�qSrr)r�orrrr Mr!z(match_indirect_regex.<locals>.<listcomp>N)r�expand�setrr)rrr#r
rrr�match_indirect_regex?s
r')rr
rcs.|rt�fdd�|D��St|t��|�SdS)a"
    Match the object (a set) with either set comparisons
    (equality or intersection) or by regex matching of the
    set members.  Regular expression matching will override
    the set equality option.

    Parameters:
    obj         The object to match. (a set)
    criteria    The criteria to match.
    equal       If set equality should be used.  Otherwise
                any set intersection will match. Ignored
                if regular expression matching is used.
    regex       If regular expression matching should be used.
    csg|]}��t|��r|�qSrrrrrrr er!z&match_regex_or_set.<locals>.<listcomp>N)rrr&)rrrr
rrr�match_regex_or_setTsr()�subset�overlap�superset�properrcCs|rX|j|jko|jknpV|j|jko:|jknpV|j|jkoV|j|jkS|r�|r�|j|jkrx|j|jkp�|j|jko�|j|jkS|j|jko�|j|jkSnp|�r|r�|j|jkr�|j|jkp�|j|jko�|j|jkS|j|jk�o�|j|jkSn|j|jk�o|j|jkSdS)aR
    Match ranges of objects.

    obj         An object with attributes named "low" and "high", representing the range.
    criteria    An object with attributes named "low" and "high", representing the criteria.
    subset      If true, the criteria will match if it is a subset obj's range.
    overlap     If true, the criteria will match if it overlaps any of the obj's range.
    superset    If true, the criteria will match if it is a superset of the obj's range.
    proper      If true, use proper superset/subset operations.
                No effect if not using set operations.
    N)ZlowZhigh)rrr)r*r+r,rrr�match_rangejs&
����r-)rr�dom�domby�incomprcCs0|r||kS|r||kS|r$||AS||kSdS)aX
    Match the an MLS level.

    obj         The level to match.
    criteria    The criteria to match. (a level)
    dom         If true, the criteria will match if it dominates obj.
    domby       If true, the criteria will match if it is dominated by obj.
    incomp      If true, the criteria will match if it is incomparable to obj.
    Nr)rrr.r/r0rrr�match_level�sr1N)�perms�tclass�policyrc	Cs�|std��|r$tdd�|D��}n|r6t|���}ntd��tdd�|D��}|D]J}||j8}tt��||jj8}Wd�n1s�0Y|sTq�qT|r�td�d�	|����ntd	�d�	|����dS)
a
    Validate that each permission is valid for at least one
    of specified object classes.  If no classes are specified,
    then all classes in the policy are checked.

    A tclass or policy must be specified.

    Parameters:
    perms       A container of str permission names.

    Keyword Parameters.
    tclass      An iterable of 1 or more ObjClass.
    policy      A SELinuxPolicy

    Exceptions:
    ValueError          Invalid parameter.
    InvalidPermission   One or more permissions is invalid.

    Return:     None
    zNo permissions specified.css|]
}|VqdS�Nr)r�crrr�	<genexpr>�r!z%validate_perms_any.<locals>.<genexpr>z(No object class(es) or policy specified.css|]
}|VqdSr5r)r�prrrr7�r!Nz7Permission(s) do not exist in the specified classes: {}z, z(Permission(s) do not exist any class: {})
�
ValueErrorr&�classesr2rr	�commonr�format�join)r2r3r4Zselected_classesZinvalidr6rrr�validate_perms_any�s2

*����r>�,)r2�	separatorrcCs�g}|�|�D]�}|�d�}t|�dkrP|�t|ddd�t|ddd�f�qt|�dkr�|�t|ddd�t|ddd�f�qtd�|���q|S)a�
    Create a extended permission list of ranges from a string representation of ranges.
    This does not do any checking for out-of-range values.

    Parameters:
    perms       A string representation of integer extended permissions, such as
                "0x08,0x30-0x40,0x55,0x60-0x65"

    Keyword Parameters:
    separator   The separator between permissions/permission ranges.
                Default is ","

    Return:     List[Tuple[int, int]] equivalent of the permissions.
    �-�r�)�baserz Unable to parse "{}" for xperms.)�split�len�append�intr9r<)r2r@Zxperms�item�rngrrr�xperm_str_to_tuple_ranges�s
((rK)NN)r?)�
contextlibr�typingrrrr�	exceptionrr	Z	policyrepr
rrrrrr"r'r(r-r1rr>rHrKrrrr�<module>s !��6

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4