/usr/lib64/python3.6/site-packages/setools/__pycache__
Edit: /usr/lib64/python3.6/site-packages/setools/__pycache__/terulequery.cpython-36.pyc (6280B)
3
^l$ @ s d dl Z d dlZddlmZmZ ddlmZmZ ddlm Z m
Z
ddlmZm
Z
ddlmZmZmZ G dd d ejejejZdS )
N )mixinsquery)CriteriaDescriptorCriteriaSetDescriptor)RuleUseErrorRuleNotConditional)IoctlSet
TERuletype)match_regexmatch_indirect_regexmatch_regex_or_setc s e Zd ZdZeedZeddZdZ dZ
eddZdZdZ
eddZdZed d
ZdZdZdZdZedd
Zejdd
Z fddZdd Z ZS )TERuleQueryae
Query the Type Enforcement rules.
Parameter:
policy The policy to query.
Keyword Parameters/Class attributes:
ruletype The list of rule type(s) to match.
source The name of the source type/attribute to match.
source_indirect If true, members of an attribute will be
matched rather than the attribute itself.
Default is true.
source_regex If true, regular expression matching will
be used on the source type/attribute.
Obeys the source_indirect option.
Default is false.
target The name of the target type/attribute to match.
target_indirect If true, members of an attribute will be
matched rather than the attribute itself.
Default is true.
target_regex If true, regular expression matching will
be used on the target type/attribute.
Obeys target_indirect option.
Default is false.
tclass The object class(es) to match.
tclass_regex If true, use a regular expression for
matching the rule's object class.
Default is false.
perms The set of permission(s) to match.
perms_equal If true, the permission set of the rule
must exactly match the permissions
criteria. If false, any set intersection
will match.
Default is false.
perms_regex If true, regular expression matching will be used
on the permission names instead of set logic.
Default is false.
perms_subset If true, the rule matches if the permissions criteria
is a subset of the rule's permission set.
Default is false.
default The name of the default type to match.
default_regex If true, regular expression matching will be
used on the default type.
Default is false.
boolean The set of boolean(s) to match.
boolean_regex If true, regular expression matching will be
used on the booleans.
Default is false.
boolean_equal If true, the booleans in the conditional
expression of the rule must exactly match the
criteria. If false, any set intersection
will match. Default is false.
)
enum_classsource_regexZlookup_type_or_attrFTtarget_regex
default_regex
boolean_regexZlookup_booleanNc C s | j S )N)_xperms)self r #/usr/lib64/python3.6/terulequery.pyxpermsd s zTERuleQuery.xpermsc C s |rt }x|D ]\}}d| ko*dkn s>tdj|d| koPdkn sdtdj|||k rv|| }}|jdd t||d D qW t|| _nd | _d S )Nr i z{0:#07x} is not a valid ioctl.c s s | ]
}|V qd S )Nr ).0ir r r
w s z%TERuleQuery.xperms..r )set
ValueErrorformatupdateranger r )r valueZpending_xpermsZlowZhighr r r r h s
"c s$ t t| j|f| tjt| _d S )N)superr __init__loggingZ getLogger__name__log)r policykwargs) __class__r r r# } s zTERuleQuery.__init__c $ c sB | j jdj| | j jdj| | j jdj| | j jdj| | j| j | j| j | j jdj| | j jdj| | j jdj| x| jj D ]}| jr|j| jkrq| j rt
|j | j | j| j rq| j
rt
|j
| j
| j| j rq| j|sqyN| jrJ|jrJ| jr8t| jdkr8w|j| jkrXwn| j|sXwW n tk
rr wY nX y&| jrt|j| j| jd rwW n tk
r wY nX | jryt
|j| jd
| jswW n tk
r wY nX | jr4y t|jj| j| j | j!swW n t"k
r2 wY nX |V qW dS )z-Generator which yields all matching TE rules.z*Generating TE rule results from {0.policy}zRuletypes: {0.ruletype}zLSource: {0.source!r}, indirect: {0.source_indirect}, regex: {0.source_regex}zLTarget: {0.target!r}, indirect: {0.target_indirect}, regex: {0.target_regex}z*Xperms: {0.xperms!r}, eq: {0.xperms_equal}z0Default: {0.default!r}, regex: {0.default_regex}zGBoolean: {0.boolean!r}, eq: {0.boolean_equal}, regex: {0.boolean_regex}r FTN)#r&