shell bypass 403
3
�^t � @ sr d dl Z d dlZddlmZmZ ddlmZmZ ddlm Z m
Z
ddlmZ ddl
mZ G dd � d ejej�ZdS )
� N� )�mixins�query)�CriteriaDescriptor�CriteriaSetDescriptor)�InvalidType�RuleUseError)�RBACRuletype)�match_indirect_regexc s� e Zd ZdZeed�Zedd�ZdZ dZ
dZdZdZ
edd �ZdZed
d�ZdZedd� �Zejd
d� �Z� fdd�Zdd� Z� ZS )�
RBACRuleQuerya�
Query the RBAC 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 role/attribute to match.
source_indirect If true, members of an attribute will be
matched rather than the attribute itself.
source_regex If true, regular expression matching will
be used on the source role/attribute.
Obeys the source_indirect option.
target The name of the target role/attribute to match.
target_indirect If true, members of an attribute will be
matched rather than the attribute itself.
target_regex If true, regular expression matching will
be used on the target role/attribute.
Obeys target_indirect option.
tclass The object class(es) to match.
tclass_regex If true, use a regular expression for
matching the rule's object class.
default The name of the default role to match.
default_regex If true, regular expression matching will
be used on the default role.
)�
enum_class�source_regex�lookup_roleFTN�tclass_regexZlookup_class�
default_regexc C s | j S )N)�_target)�self� r �%/usr/lib64/python3.6/rbacrulequery.py�targetG s zRBACRuleQuery.targetc C sZ |sd | _ nJ| jr tj|�| _ n6y| jj|�| _ W n" tk
rT | jj|�| _ Y nX d S )N)r �target_regex�re�compile�policyZlookup_type_or_attrr r )r �valuer r r r K s c s$ t t| �j|f|� tjt�| _d S )N)�superr �__init__�loggingZ getLogger�__name__�log)r r �kwargs)� __class__r r r W s zRBACRuleQuery.__init__c c s> | j jdj| �� | j jdj| �� | j jdj| �� | j jdj| �� | j| j � | j jdj| �� x�| jj� D ]�}| jr�|j| jkr�qr| jr�t |j| j| j
| j� r�qr| jr�t |j| j| j
| j� r�qry| j|�s�wrW n tk
r� wrY nX | j�r0yt |j| jd| j��swrW n tk
�r. wrY nX |V qrW dS )z/Generator which yields all matching RBAC rules.z,Generating RBAC 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}z0Default: {0.default!r}, regex: {0.default_regex}TN)r �info�format�debugZ_match_object_class_debugr Z rbacrules�ruletype�sourcer
�source_indirectr
r �target_indirectr Z_match_object_classr �defaultr )r Zruler r r �results[ sP
zRBACRuleQuery.results)r �
__module__�__qualname__�__doc__r r r% r r&