404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.223.172.243: ~ $
3

Kl�f�!�@sbdZddlZddlmZddlmZddlmZGdd�dej�ZGd	d
�d
�ZGdd�d�Z	dS)
zI
Classes and algorithms for matching requested access to access vectors.
�N�)�access)�objectmodel)�utilc@seZdZddd�Zdd�ZdS)�MatchNrcCs||_||_d|_d|_dS)NF)�	interface�dist�info_dir_change�__hash__)�selfrr�r�/usr/lib/python3.6/matching.py�__init__ szMatch.__init__cCs@y"|j|jf}|j|jf}|||�Sttfk
r:tSXdS)N)rr	�AttributeError�	TypeError�NotImplemented)r�other�method�a�brrr
�_compare(s
zMatch._compare)Nr)�__name__�
__module__�__qualname__rrrrrr
rs
rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�	MatchList�cCs$g|_g|_|j|_d|_d|_dS)NF)�children�bastards�DEFAULT_THRESHOLD�	threshold�allow_info_dir_change�av)rrrr
r3s
zMatchList.__init__cCs,t|j�r|jdSt|j�r(|jdSdS)Nr)�lenrr)rrrr
�best<s




zMatchList.bestcCst|j�t|j�S)N)r"rr)rrrr
�__len__CszMatchList.__len__cCs
t|j�S)N)�iterr)rrrr
�__iter__IszMatchList.__iter__cCstj|j|j�S)N)�	itertools�chainrr)rrrr
�allLsz
MatchList.allcCsF|j|jkr6|js|jr(|jj|�qB|jj|�n|jj|�dS)N)rrr	r r�appendr)r�matchrrr
r*Os
zMatchList.appendcCs|jj�|jj�dS)N)r�sortr)rrrr
r,Xs
zMatchList.sortN)rrrrrr#r$r&r)r*r,rrrr
r1s		rc@s>eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�
AccessMatcherNcCs,d|_d|_|r||_n
tj�|_d|_dS)N�
�d)�type_penalty�obj_penalty�	perm_mapsrZPermMappings�info_dir_penalty)rr2rrr
r^s
zAccessMatcher.__init__cCs"||kstj|�rdS|jSdS)Nr)r�
is_idparamr0)rrrrrr
�
type_distancejszAccessMatcher.type_distancecCsR|jj|j�}t|�dkr0|jj|j|�}|S|jj|j�}|jj|j|�SdS)Nr)�perms�
differencer"r2�getdefault_distance�	obj_class)rZav_reqZav_provZdiffZtotalrrr
�
perm_distanceqszAccessMatcher.perm_distancecCs�d}||j|j|j�7}||j|j|j�7}|j|jkrPtj|j�rP||j8}|dkrl|jj|j|j	�}n|j
||�}|dkr�|dkr�||S||Sn |dkr�|dkr�||S||SdS)a+Determine the 'distance' between 2 access vectors.

        This function is used to find an access vector that matches
        a 'required' access. To do this we comput a signed numeric
        value that indicates how close the req access is to the
        'provided' access vector. The closer the value is to 0
        the closer the match, with 0 being an exact match.

        A value over 0 indicates that the prov access vector provides more
        access than the req (in practice, this means that the source type,
        target type, and object class is the same and the perms in prov is
        a superset of those in req.

        A value under 0 indicates that the prov access less - or unrelated
        - access to the req access. A different type or object class will
        result in a very low value.

        The values other than 0 should only be interpreted relative to
        one another - they have no exact meaning and are likely to
        change.

        Params:
          req - [AccessVector] The access that is required. This is the
                access being matched.
          prov - [AccessVector] The access provided. This is the potential
                 match that is being evaluated for req.
        Returns:
          0   : Exact match between the acess vectors.

          < 0 : The prov av does not provide all of the access in req.
                A smaller value indicates that the access is further.

          > 0 : The prov av provides more access than req. The larger
                the value the more access over req.
        rN)r5Zsrc_type�tgt_typer9rr4r1r2r8r6r:)rZreqZprovrZpdistrrr
�av_distance|s '

zAccessMatcher.av_distancecCs�d}xf|D]^}|j||�}|dkr(|}q
|dkrN|dkrB||7}qh||}q
|dkr`||7}q
||8}q
W|jj|j|j�}|jdkr�tj|_x&|D]}|j|jj|j|j�B|_q�W|tj@dkr�|jtj@r�|dkr�||j	8}n
||j	7}|S)z


        Nr)
r<r2Zgetdefault_directionr9r6Zinfo_dirrZ	FLOW_NONEZ
FLOW_WRITEr3)rZav_setr!r�xZtmpZav_dirrrr
�av_set_match�s.





zAccessMatcher.av_set_matchcCsh||_xTtj|j|jj|jg��D]6}|js.q"|j|j	|�}|dkr"t
||�}|j|�q"W|j�dS)Nr)
r!r'r(Ztgt_type_allZtgt_type_map�getr;Zenabledr>rrr*r,)rZifsetr!Z
match_listZivr�mrrr
�
search_ifs�s

zAccessMatcher.search_ifs)N)	rrrrr5r:r<r>rArrrr
r-]s
H(r-)
�__doc__r'�rrrZ
Comparisonrrr-rrrr
�<module>s,

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
access.cpython-36.opt-1.pyc File 11.02 KB 0644
access.cpython-36.pyc File 11.02 KB 0644
audit.cpython-36.opt-1.pyc File 17.29 KB 0644
audit.cpython-36.pyc File 17.29 KB 0644
classperms.cpython-36.opt-1.pyc File 2.43 KB 0644
classperms.cpython-36.pyc File 2.43 KB 0644
defaults.cpython-36.opt-1.pyc File 2.19 KB 0644
defaults.cpython-36.pyc File 2.19 KB 0644
interfaces.cpython-36.opt-1.pyc File 12.25 KB 0644
interfaces.cpython-36.pyc File 12.25 KB 0644
lex.cpython-36.opt-1.pyc File 20.92 KB 0644
lex.cpython-36.pyc File 20.92 KB 0644
matching.cpython-36.opt-1.pyc File 5.95 KB 0644
matching.cpython-36.pyc File 5.95 KB 0644
module.cpython-36.opt-1.pyc File 6.95 KB 0644
module.cpython-36.pyc File 6.95 KB 0644
objectmodel.cpython-36.opt-1.pyc File 3.83 KB 0644
objectmodel.cpython-36.pyc File 3.83 KB 0644
output.cpython-36.opt-1.pyc File 3.42 KB 0644
output.cpython-36.pyc File 3.42 KB 0644
policygen.cpython-36.opt-1.pyc File 12.52 KB 0644
policygen.cpython-36.pyc File 12.57 KB 0644
refparser.cpython-36.opt-1.pyc File 28.38 KB 0644
refparser.cpython-36.pyc File 28.38 KB 0644
refpolicy.cpython-36.opt-1.pyc File 39.9 KB 0644
refpolicy.cpython-36.pyc File 39.9 KB 0644
sepolgeni18n.cpython-36.opt-1.pyc File 304 B 0644
sepolgeni18n.cpython-36.pyc File 304 B 0644
util.cpython-36.opt-1.pyc File 6.22 KB 0644
util.cpython-36.pyc File 6.22 KB 0644
yacc.cpython-36.opt-1.pyc File 52.77 KB 0644
yacc.cpython-36.pyc File 52.86 KB 0644