MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: sanbercountryclu (1012)
PHP: 8.2.33
Disabled: NONE
Upload Files
File: //lib/python3.12/site-packages/sepolgen/__pycache__/objectmodel.cpython-312.pyc
�

�jw��p�dZgd�ZdZdZdZeezZeeeed�Zedededed	iZGd
�d�ZGd�d
�Z	y)z�
This module provides knowledge object classes and permissions. It should
be used to keep this knowledge from leaking into the more generic parts of
the policy generation.
)	�socket�fd�process�file�lnk_file�	fifo_file�dbus�
capability�unix_stream_socket���)�n�r�w�brrrrc��eZdZdZd�Zd�Zy)�PermMapaA mapping between a permission and its information flow properties.

    PermMap represents the information flow properties of a single permission
    including the direction (read, write, etc.) and an abstract representation
    of the bandwidth of the flow (weight).
    c�.�||_||_||_y�N)�perm�dir�weight)�selfrrrs    �9/usr/lib/python3.12/site-packages/sepolgen/objectmodel.py�__init__zPermMap.__init__Ts����	�������c�\�d|jt|j|jfzS)Nz'<sepolgen.objectmodel.PermMap %s %s %d>)r�
dir_to_strrr�rs r�__repr__zPermMap.__repr__Ys0��8�D�I�I�;E�d�h�h�;O�;?�;�;�<H�H�	HrN)�__name__�
__module__�__qualname__�__doc__rr �rrrrMs����
Hrrc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�PermMappingsz�The information flow properties of a set of object classes and permissions.

    PermMappings maps one or more classes and permissions to their PermMap objects
    describing their information flow characteristics.
    c�6�i|_d|_t|_y)N�)�classes�default_weight�	FLOW_BOTH�default_dirrs rrzPermMappings.__init__ds��������$��rc	��d}|D]�}|j�}t|�dk(st|�dk(s|ddk(r�8|ddk(r=|d}||jvrtd��i|j|<|j|}�}t|�dk7rtd��|�td	��t	|dt
|dt
|d
��}|||j<��y)zsRead the permission mappings from a file. This reads the format used
        by Apol in the setools suite.
        Nrr�#�classzduplicate class in perm map�z!error in object class permissionszpermission outside of classr
)�split�lenr*�
ValueErrorr�
str_to_dir�intr)rr�cur�line�fields�c�pms       r�	from_filezPermMappings.from_fileis������D��Z�Z�\�F��6�{�a��3�v�;�!�#3�v�a�y�C�7G���a�y�G�#��1�I������$�$�%B�C�C�"%����Q���l�l�1�o���v�;�!�#�$�%H�I�I��;�$�%B�C�C��V�A�Y�
�6�!�9�(=�s�6�!�9�~�N��!��B�G�G��!rc�&�|j||S)z�Get the permission map for the object permission.

        Returns:
          PermMap representing the permission
        Raises:
          KeyError if the object or permission is not defined
        )r*)r�objrs   r�getzPermMappings.get�s���|�|�C� ��&�&rc��	|j||}|S#t$r$t||j|j�cYSwxYw)aGet the permission map for the object permission or a default.

        getdefault is the same as get except that a default PermMap is
        returned if the object class or permission is not defined. The
        default is FLOW_BOTH with a weight of 5.
        )r*�KeyErrorrr-r+)rr>rr;s    r�
getdefaultzPermMappings.getdefault�sP��	H����c�"�4�(�B��	���	H��4��!1�!1�4�3F�3F�G�G�	H�s��*A�Ac�b�t}|D]#}|j||�}||jz}�%|Sr)�	FLOW_NONErBr)rr>�permsrrr;s      r�getdefault_directionz!PermMappings.getdefault_direction�s5�����D�����d�+�B�����,�C���
rc�Z�d}|D]#}|j||�}||jz
}�%|S)Nr)rBr)rr>rE�totalrr;s      r�getdefault_distancez PermMappings.getdefault_distance�s6�����D�����d�+�B��R�Y�Y��E���rN)
r!r"r#r$rr<r?rBrFrIr%rrr'r'^s%���
%�
"�8'���rr'N)
r$�implicitly_typed_objectsrD�	FLOW_READ�
FLOW_WRITEr,r5rrr'r%rr�<module>rMsl��(�(H��8�	�
�	�
�
�
��
#�	��i�z��
T�
��3�	�C��c�9�s�
T�
�H�H�"K�Kr