404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.16.212.0: ~ $
3

Kl�fw�@s�dZddlZddlZyddlmZWn ek
rDddlmZYnXddlZddlZddl	Z	ddl
Z
ddlmZdd�Z
Gdd	�d	�Zd
d�ZGdd
�d
�ZdS)zU
Utilities for dealing with the compilation of modules and creation
of module tress.
�N)�getstatusoutput�)�defaultscCs0tjd|�}t|�dkr(|dj�r(dSdSdS)z'Check that a module name is valid.
    z[^a-zA-Z0-9_\-\.]rTFN)�re�findall�len�isalpha)�modname�m�r�/usr/lib/python3.6/module.py�
is_valid_name(sr
c@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dS)�
ModuleTreecCs||_d|_dS)N)r	�dirname)�selfr	rrr�__init__2szModuleTree.__init__cCs|jS)N)r)rrrr�dir_name6szModuleTree.dir_namecCs|jd|jdS)N�/z.te)rr	)rrrr�te_name9szModuleTree.te_namecCs|jd|jdS)Nrz.fc)rr	)rrrr�fc_name<szModuleTree.fc_namecCs|jd|jdS)Nrz.if)rr	)rrrr�if_name?szModuleTree.if_namecCs|jd|jdS)Nrz.pp)rr	)rrrr�package_nameBszModuleTree.package_namecCs
|jdS)Nz	/Makefile)r)rrrr�
makefile_nameEszModuleTree.makefile_nameNcCs�|d|j|_tj|j�t|j�d�}|r>|jd|�n|jdtj��|j	�t|j
�d�j	�t|j�d�j	�t|j�d�j	�dS)Nr�wzinclude )
r	r�os�mkdir�openr�writer�refpolicy_makefile�closerrr)rZparent_dirnameZmakefile_include�fdrrr�createHszModuleTree.create)N)�__name__�
__module__�__qualname__rrrrrrrr!rrrrr1srcCstjjtjj|�d�dS)Nrr)r�path�splitext�split)�
sourcenamerrr�modname_from_sourcenameXsr)c@sTeZdZdZddd�Zdd�Zdd�Zd	d
�Zddd
�Zdd�Z	dd�Z
dd�ZdS)�ModuleCompileratModuleCompiler eases running of the module compiler.

    The ModuleCompiler class encapsulates running the commandline
    module compiler (checkmodule) and module packager (semodule_package).
    You are likely interested in the create_module_package method.
    
    Several options are controlled via paramaters (only effects the 
    non-refpol builds):
    
     .mls          [boolean] Generate an MLS module (by passed -M to
                   checkmodule). True to generate an MLS module, false
                   otherwise.
                   
     .module       [boolean] Generate a module instead of a base module.
                   True to generate a module, false to generate a base.
                   
     .checkmodule  [string] Fully qualified path to the module compiler.
                   Default is /usr/bin/checkmodule.
                   
     .semodule_package [string] Fully qualified path to the module
                   packager. Defaults to /usr/bin/semodule_package.
     .output       [file object] File object used to write verbose
                   output of the compililation and packaging process.
    NcCs<tj�|_d|_d|_d|_||_d|_tj	�|_
d|_dS)z�Create a ModuleCompiler instance, optionally with an
        output file object for verbose output of the compilation process.
        Tz/usr/bin/checkmodulez/usr/bin/semodule_package�z
/usr/bin/makeN)�selinuxZis_selinux_mls_enabled�mls�module�checkmodule�semodule_package�output�last_outputrr�refpol_makefile�make)rr1rrrrts

zModuleCompiler.__init__cCs |jr|jj|d�||_dS)N�
)r1rr2)r�strrrr�o�szModuleCompiler.ocCs$|j|�t|�\}}|j|�|S)N)r7r)r�command�rcr1rrr�run�s

zModuleCompiler.runcCsJ|jd�}t|�dkr td|��dj|dd��}|d}|d}||fS)	z�Generate the module and policy package filenames from
        a source file name. The source file must be in the form
        of "foo.te". This will generate "foo.mod" and "foo.pp".
        
        Returns a tuple with (modname, policypackage).
        �.�z,invalid sourcefile name %s (must end in .te)rrz.modz.pp���)r'r�RuntimeError�join)rr(Z	splitname�basenamer	�packagenamerrr�
gen_filenames�s

zModuleCompiler.gen_filenamesTcCsD|r|j|�n0|j|�\}}|j||�|j||�tj|�dS)a�Create a module package saved in a packagename from a
        sourcename.

        The create_module_package creates a module package saved in a
        file named sourcename (.pp is the standard extension) from a
        source file (.te is the standard extension). The source file
        should contain SELinux policy statements appropriate for a
        base or non-base module (depending on the setting of .module).

        Only file names are accepted, not open file objects or
        descriptors because the command line SELinux tools are used.

        On error a RuntimeError will be raised with a descriptive
        error message.
        N)�refpol_buildrB�compile�packager�unlink)rr(Z	refpolicyr	rArrr�create_module_package�sz$ModuleCompiler.create_module_packagecCs4|jd|j}|j|�}|dkr0td|j��dS)Nz -f rzcompilation failed:
%s)r4r3r:r>r2)rr(r8r9rrrrC�s
zModuleCompiler.refpol_buildcCsp|jg}|jr|jd�|jr(|jd�|jd�|j|�|j|�|jdj|��}|dkrltd|j��dS)Nz-Mz-mz-o� rzcompilation failed:
%s)r/r-�appendr.r:r?r>r2)rr(r	�sr9rrrrD�s




zModuleCompiler.compilecCsZ|jg}|jd�|j|�|jd�|j|�|jdj|��}|dkrVtd|j��dS)Nz-oz-mrHrzpackaging failed [%s])r0rIr:r?r>r2)rr	rArJr9rrrrE�s



zModuleCompiler.package)N)T)r"r#r$�__doc__rr7r:rBrGrCrDrErrrrr*[s


	r*)rKrZtempfile�
subprocessr�ImportErrorZcommandsrZos.pathZshutilr,r+rr
rr)r*rrrr�<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