404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.142.249.163: ~ $
3

�^�"�@stddlmZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
Gd	d
�d
e�ZGdd�de	�Zd
S)�)�
namedtuple�)�ConstraintRuletype�)�DiffResultDescriptor)�
Difference�
SymbolWrapper�Wrapper)�class_wrapper_factory)�type_wrapper_factoryc@s�eZdZdZed�Zed�Zed�Zed�Zed�Z	ed�Z
ed�Zed�ZdZ
dZdZdZdZdZdZdZdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�ZdS)�ConstraintsDifferencea�
    Determine the difference in constraints between two policies.

    Since the compiler does not union constraints, there may be multiple
    constraints with the same ruletype, object class, and permission
    set, so constraints can only be added or removed, not modified.

    The constraint expressions are compared only on a basic level.
    Expressions that are logically equivalent but are structurally
    different, for example, by associativity, will be considered
    different.  Type and role attributes are also not expanded,
    so if there are changes to attribute members, it will not
    be reflected as a difference.
    �diff_constrains�diff_mlsconstrains�diff_validatetrans�diff_mlsvalidatetransNcCs`|jjdj|��|jdks&|jdkr.|j�|jdd�|jD�dd�|jD��\|_|_}dS)zAGenerate the difference in constraint rules between the policies.zJGenerating constraint differences from {0.left_policy} to {0.right_policy}Ncss|]}t|�VqdS)N)�ConstraintWrapper)�.0�c�r�#/usr/lib64/python3.6/constraints.py�	<genexpr>Qsz8ConstraintsDifference.diff_constrains.<locals>.<genexpr>css|]}t|�VqdS)N)r)rrrrrrRs)	�log�info�format�_left_constrains�_right_constrains�_create_constrain_lists�	_set_diff�added_constrains�removed_constrains)�self�_rrrr
Gs
z%ConstraintsDifference.diff_constrainscCs`|jjdj|��|jdks&|jdkr.|j�|jdd�|jD�dd�|jD��\|_|_}dS)zEGenerate the difference in MLS constraint rules between the policies.zNGenerating MLS constraint differences from {0.left_policy} to {0.right_policy}Ncss|]}t|�VqdS)N)r)rrrrrr_sz;ConstraintsDifference.diff_mlsconstrains.<locals>.<genexpr>css|]}t|�VqdS)N)r)rrrrrr`s)	rrr�_left_mlsconstrains�_right_mlsconstrainsrr�added_mlsconstrains�removed_mlsconstrains)r r!rrrrTsz(ConstraintsDifference.diff_mlsconstrainscCs`|jjdj|��|jdks&|jdkr.|j�|jdd�|jD�dd�|jD��\|_|_}dS)zDGenerate the difference in validatetrans rules between the policies.zMGenerating validatetrans differences from {0.left_policy} to {0.right_policy}Ncss|]}t|�VqdS)N)r)rrrrrrmsz;ConstraintsDifference.diff_validatetrans.<locals>.<genexpr>css|]}t|�VqdS)N)r)rrrrrrns)	rrr�_left_validatetrans�_right_validatetransrr�added_validatetrans�removed_validatetrans)r r!rrrrbsz(ConstraintsDifference.diff_validatetranscCs`|jjdj|��|jdks&|jdkr.|j�|jdd�|jD�dd�|jD��\|_|_}dS)zHGenerate the difference in MLS validatetrans rules between the policies.zPGenerating mlsvalidatetrans differences from {0.left_policy} to {0.right_policy}Ncss|]}t|�VqdS)N)r)rrrrrr{sz>ConstraintsDifference.diff_mlsvalidatetrans.<locals>.<genexpr>css|]}t|�VqdS)N)r)rrrrrr|s)	rrr�_left_mlsvalidatetrans�_right_mlsvalidatetransrr�added_mlsvalidatetrans�removed_mlsvalidatetrans)r r!rrrrpsz+ConstraintsDifference.diff_mlsvalidatetranscCsZg|_g|_g|_g|_x�|jj�D]�}|jtjkrB|jj	|�q$|jtj
kr\|jj	|�q$|jtjkrv|jj	|�q$|jtjkr�|jj	|�q$|j
jdj|j��q$Wg|_g|_g|_g|_x�|jj�D]�}|jtjkr�|jj	|�q�|jtj
k�r|jj	|�q�|jtjk�r"|jj	|�q�|jtjk�r>|jj	|�q�|j
jdj|j��q�WdS)z$Create rule lists for both policies.z/Unknown rule type: {0} (This is an SETools bug)N)rr"r&r*Zleft_policyZconstraints�ruletyperZ	constrain�appendZmlsconstrainZ
validatetransZmlsvalidatetransr�errorrrr#r'r+Zright_policy)r �rulerrrr�s<

z-ConstraintsDifference._create_constrain_listscCsp|jjd�d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_dS)z%Reset diff results on policy changes.z%Resetting all constraints differencesN)r�debugrrr$r%r(r)r,r-rr"r&r*rr#r'r+)r rrr�_reset_diff�s"z!ConstraintsDifference._reset_diff)�__name__�
__module__�__qualname__�__doc__rrrr$r%r(r)r,r-rrr"r#r&r'r*r+r
rrrrr3rrrrrs.
$rc@s4eZdZdZdZdd�Zdd	�Zd
d�Zdd
�ZdS)rz#Wrap constraints for diff purposes.r.�tclass�perms�exprc
Cs�||_|j|_t|j�|_y|j|_Wntk
r@d|_YnXt|�|_g|_x@|j	D]6}t
|t�r�|jjtdd�|D���qZ|jj|�qZWdS)Ncss|]}t|�VqdS)N)r)r�itemrrrr�sz-ConstraintWrapper.__init__.<locals>.<genexpr>)
�originr.r
r8r9�AttributeError�hash�keyr:Z
expression�
isinstance�	frozensetr/)r r1�oprrr�__init__�s

zConstraintWrapper.__init__cCs|jS)N)r?)r rrr�__hash__�szConstraintWrapper.__hash__cCs|j|jkS)N)r?)r �otherrrr�__lt__�szConstraintWrapper.__lt__cCs0|j|jko.|j|jko.|j|jko.|j|jkS)N)r.r8r9r:)r rErrr�__eq__�szConstraintWrapper.__eq__N)r.r8r9r:)	r4r5r6r7�	__slots__rCrDrFrGrrrrr�srN)�collectionsrZ	policyreprZdescriptorsr�
differencerrr	Zobjclassr
�typesrrrrrrr�<module>s 

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 1.99 KB 0644
__init__.cpython-36.pyc File 1.99 KB 0644
bool.cpython-36.opt-1.pyc File 2.12 KB 0644
bool.cpython-36.pyc File 2.12 KB 0644
bounds.cpython-36.opt-1.pyc File 3.42 KB 0644
bounds.cpython-36.pyc File 3.42 KB 0644
commons.cpython-36.opt-1.pyc File 1.82 KB 0644
commons.cpython-36.pyc File 1.82 KB 0644
conditional.cpython-36.opt-1.pyc File 1.42 KB 0644
conditional.cpython-36.pyc File 1.42 KB 0644
constraints.cpython-36.opt-1.pyc File 7.03 KB 0644
constraints.cpython-36.pyc File 7.03 KB 0644
context.cpython-36.opt-1.pyc File 1.45 KB 0644
context.cpython-36.pyc File 1.45 KB 0644
default.cpython-36.opt-1.pyc File 2.85 KB 0644
default.cpython-36.pyc File 2.85 KB 0644
descriptors.cpython-36.opt-1.pyc File 1.07 KB 0644
descriptors.cpython-36.pyc File 1.07 KB 0644
difference.cpython-36.opt-1.pyc File 4.83 KB 0644
difference.cpython-36.pyc File 5 KB 0644
fsuse.cpython-36.opt-1.pyc File 2.64 KB 0644
fsuse.cpython-36.pyc File 2.64 KB 0644
genfscon.cpython-36.opt-1.pyc File 2.73 KB 0644
genfscon.cpython-36.pyc File 2.73 KB 0644
ibendportcon.cpython-36.opt-1.pyc File 2.75 KB 0644
ibendportcon.cpython-36.pyc File 2.75 KB 0644
ibpkeycon.cpython-36.opt-1.pyc File 2.73 KB 0644
ibpkeycon.cpython-36.pyc File 2.73 KB 0644
initsid.cpython-36.opt-1.pyc File 1.86 KB 0644
initsid.cpython-36.pyc File 1.86 KB 0644
mls.cpython-36.opt-1.pyc File 8.62 KB 0644
mls.cpython-36.pyc File 8.62 KB 0644
mlsrules.cpython-36.opt-1.pyc File 3.4 KB 0644
mlsrules.cpython-36.pyc File 3.4 KB 0644
netifcon.cpython-36.opt-1.pyc File 2.76 KB 0644
netifcon.cpython-36.pyc File 2.76 KB 0644
nodecon.cpython-36.opt-1.pyc File 2.64 KB 0644
nodecon.cpython-36.pyc File 2.64 KB 0644
objclass.cpython-36.opt-1.pyc File 2.43 KB 0644
objclass.cpython-36.pyc File 2.43 KB 0644
polcap.cpython-36.opt-1.pyc File 1.44 KB 0644
polcap.cpython-36.pyc File 1.44 KB 0644
portcon.cpython-36.opt-1.pyc File 2.68 KB 0644
portcon.cpython-36.pyc File 2.68 KB 0644
properties.cpython-36.opt-1.pyc File 1.3 KB 0644
properties.cpython-36.pyc File 1.3 KB 0644
rbacrules.cpython-36.opt-1.pyc File 4.85 KB 0644
rbacrules.cpython-36.pyc File 4.85 KB 0644
roles.cpython-36.opt-1.pyc File 2.39 KB 0644
roles.cpython-36.pyc File 2.39 KB 0644
terules.cpython-36.opt-1.pyc File 14.25 KB 0644
terules.cpython-36.pyc File 14.25 KB 0644
typeattr.cpython-36.opt-1.pyc File 2.52 KB 0644
typeattr.cpython-36.pyc File 2.52 KB 0644
types.cpython-36.opt-1.pyc File 3.08 KB 0644
types.cpython-36.pyc File 3.08 KB 0644
users.cpython-36.opt-1.pyc File 3.05 KB 0644
users.cpython-36.pyc File 3.05 KB 0644