404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.129.71.42: ~ $
3

\�me�4�
@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZeje
�Zejdddg�Zd	d
�ZGdd�de�Zdddd
ddddddddd�dd�Zddd�Zddd�Zdd�Zddd�ZdS)z9Common utility functions for interacting with subprocess.�N)�ENOEXEC)�
TextIOWrapper)�List�Union�
SubpResult�stdout�stderrcCs�g}g}g}x�|D]�}t|t�rT|ddkr:|dd�}q�|d|kr�|jd|�n6t|t�rz|j|�d��s�|j|�n|jt|��q|j|�qW|r�tjd||dj|��|r�t	dj
|dj|�d���|S)	a�Ensure user-provided commands start with base_command; warn otherwise.

    Each command is either a list or string. Perform the following:
       - If the command is a list, pop the first element if it is None
       - If the command is a list, insert base_command as the first element if
         not present.
       - When the command is a string not starting with 'base-command', warn.

    Allow flexibility to provide non-base-command environment/config setup if
    needed.

    @commands: List of commands. Each command element is a list or string.

    @return: List of 'fixed up' commands.
    @raise: TypeError on invalid config item type.
    rN�� z Non-%s commands in %s config:
%s�
zHInvalid {name} config. These commands are not a string or list:
{errors})�name�errors)�
isinstance�list�insert�str�
startswith�append�LOG�warning�join�	TypeError�format)Zbase_commandZcommands�warningsr
Zfixed_commands�command�r�/usr/lib/python3.6/subp.py�prepend_base_commands4


rc@sHeZdZdZdZddd�Zdd�Zd
eee	feee	fd	�d
d�Z
dS)�ProcessExecutionErrorzr%(description)s
Command: %(cmd)s
Exit code: %(exit_code)s
Reason: %(reason)s
Stdout: %(stdout)s
Stderr: %(stderr)s�-Nc	Cs|p|j|_|r||_n|r.|tkr.d|_nd|_t|t�rB|n|j|_|sd|dkr\|jn||_n|j|�|_|s�|dkr�|jn||_	n|j|�|_	|p�|j|_
|r�||_|j|j
|j�|j
|j�|j
|j�|j
|j	�|j
|j�|j
|j
�d�}tj||�dS)Nz(Exec format error. Missing #! in script?z'Unexpected error while running command.)�description�cmd�	exit_coderr�reason)�
empty_attrr!r rr�intr"r�_indent_textrr#�errno�MESSAGE_TMPL�_ensure_string�IOError�__init__)	�selfrrr"r!r r#r'�messagerrrr+Os0





zProcessExecutionError.__init__cCst|t�r|j�S|S)z1
        if data is bytes object, decode
        )r�bytes�decode)r,�textrrrr)~sz$ProcessExecutionError._ensure_string�)r0�returncCs>t|t�s$|jd�jddd|�S|jd�jddd|�S)z�
        indent text on all but the first line, allowing for easy to read output

        remove any newlines at end of text first to prevent unneeded blank
        line in output
        rr
�
� )rr.�rstrip�replace)r,r0Zindent_levelrrrr&�s	
z"ProcessExecutionError._indent_text)NNNNNNN)r1)�__name__�
__module__�__qualname__r(r$r+r)rrr.r&rrrrrDs
'rTFr6)�data�rcs�env�capture�combine_capture�shell�	logstringr/�target�
update_env�	status_cb�cwdcs�|	dk	rtd��|dkrdg}d}
|
rF|dkr4tj}|j�}|j|
�t|	�dkrbd|	gt|�}|r�t|t�rzdj|�n|}|dj	|d��|s�t
jd	||||r�d
n|�nt
jd|�d}d}|r�tj
}tj
}|r�tj
}tj}|dkr�ttj�}
|
}ntj
}t|t��s|j�}t|t��r&|}n&t|t��r>|jd�}nd
d�|D�}z�y*tj|||||||d�}|j|�\}}Wn\tk
�r�}z>|�r�|d�t|||j��r�dnd��r�dndd�|�WYdd}~XnXWd|
�r�|
j�X|�s�|�r
|�sd}|�s
d}��r.d�fdd�	}||�}||�}|j}||k�rd|�rT|dj	|d��t||||d��|�rz|dj	|d��t||�S)a�Run a subprocess.

    :param args: command to run in a list. [cmd, arg1, arg2...]
    :param data: input to the command, made available on its stdin.
    :param rcs:
        a list of allowed return codes.  If subprocess exits with a value not
        in this list, a ProcessExecutionError will be raised.  By default,
        data is returned as a string.  See 'decode' parameter.
    :param env: a dictionary for the command's environment.
    :param capture:
        boolean indicating if output should be captured.  If True, then stderr
        and stdout will be returned.  If False, they will not be redirected.
    :param combine_capture:
        boolean indicating if stderr should be redirected to stdout. When True,
        interleaved stderr and stdout will be returned as the first element of
        a tuple, the second will be empty string or bytes (per decode).
        if combine_capture is True, then output is captured independent of
        the value of capture.
    :param shell: boolean indicating if this should be run with a shell.
    :param logstring:
        the command will be logged to DEBUG.  If it contains info that should
        not be logged, then logstring will be logged instead.
    :param decode:
        if False, no decoding will be done and returned stdout and stderr will
        be bytes.  Other allowed values are 'strict', 'ignore', and 'replace'.
        These values are passed through to bytes().decode() as the 'errors'
        parameter.  There is no support for decoding to other than utf-8.
    :param target:
        not supported, kwarg present only to make function signature similar
        to curtin's subp.
    :param update_env:
        update the enviornment for this command with this dictionary.
        this will not affect the current processes os.environ.
    :param status_cb:
        call this fuction with a single string argument before starting
        and after finishing.
    :param cwd:
        change the working directory to cwd before executing the command.

    :return
        if not capturing, return is (None, None)
        if capturing, stdout and stderr are returned.
            if decode:
                entries in tuple will be string
            if not decode:
                entries in tuple will be bytes
    Nz&target arg not supported by cloud-initr�/�chrootr
zBegin run command: {command}
)rzFRunning command %s with allowed return codes %s (shell=%s, capture=%s)ZcombinezFRunning hidden command to protect sensitive input/output logstring: %s�utf-8cSs$g|]}t|t�r|n|jd��qS)zutf-8)rr.�encode)�.0�xrrr�
<listcomp>szsubp.<locals>.<listcomp>)rr�stdinr<r?rDz1ERROR: End run command: invalid command provided
r�-)r!r#r'rr�cst|t�r|j|��S|S)N)rr.r/)r:�m)r/rr�ldecode8szsubp.<locals>.ldecodez%ERROR: End run command: exit({code})
)�code)rrr"r!zEnd run command: exit({code})
)rG)�
ValueError�os�environ�copy�update�target_pathrrrrr�debug�
subprocess�PIPEZSTDOUT�open�devnullr.rHr�PopenZcommunicate�OSErrorrr'�close�
returncoder)�argsr:r;r<r=r>r?r@r/rArBrCrDZ
devnull_fprrrrLZ
bytes_argsZsp�out�err�erPZrcr)r/r�subp�s�B



recCs�|dkrd}n<t|t�s(td|����n"tjj|�}|jd�rJ|dd�}|sR|Sx$t|�rv|ddkrv|dd�}qTWtjj||�S)N�rEzUnexpected input for target: z//r	r)Nrf)	rrrRrS�path�abspathr�lenr)rArgrrrrWJs

rWcCs�t|�}tjj|kr&tt||��r&|S|dkrhdd�tjjdd�jtj�D�}|dkrZ|ndd�|D�}dd�|D�}x0|D](}tjjj	||f�}tt||��r||Sq|WdS)NcSsg|]}|jd��qS)�")�strip)rI�prrrrKjszwhich.<locals>.<listcomp>�PATHrfrEcSsg|]}|jd�r|�qS)rE)r)rIrlrrrrKmscSsg|]}tjj|��qSr)rSrgrh)rIrlrrrrKps)
rWrSrg�sep�is_exerT�get�split�pathsepr)Zprogram�searchrA�pathsrgZppathrrr�which_s 
rucCstjj|�otj|tj�S)N)rSrg�isfile�access�X_OK)Zfpathrrrrozsroc	Cs&|rtjj|�rdSg}g}|dkr,g}n.t|t�rBt|�g}nt|t�rR|}ntd��x�ttj|��D]�}tjj	||�}t
|�r�|j|�yt||gdd�Wq�t
k
r�}ztj|�|j|�WYdd}~Xq�Xqjtjd|�qjW|o�|�r"tdt|��ddj	|��dt|��d	���dS)
Nz%exe_prefix must be None, str, or listF)r=zjskipping %s as its not executable or the underlying file system is mounted without executable permissions.z
Runparts: z failures (�,z) in z attempted commands)rSrg�isdirrrrr�sorted�listdirrrorrerrrXr�RuntimeErrorri)	ZdirpZ
skip_no_existZ
exe_prefixZfailedZ	attempted�prefixZexe_nameZexe_pathrdrrr�runpartss4





r)N)NN)TN)�__doc__�collectionsZloggingrSrYr'r�iorZtypingrrZ	getLoggerr7r�
namedtuplerrr*rrerWrurorrrrr�<module>s8
3Q+



Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
apport.cpython-36.opt-1.pyc File 5.92 KB 0644
apport.cpython-36.pyc File 5.96 KB 0644
atomic_helper.cpython-36.opt-1.pyc File 2.05 KB 0644
atomic_helper.cpython-36.pyc File 2.05 KB 0644
cloud.cpython-36.opt-1.pyc File 3.08 KB 0644
cloud.cpython-36.pyc File 3.08 KB 0644
dmi.cpython-36.opt-1.pyc File 5.32 KB 0644
dmi.cpython-36.pyc File 5.32 KB 0644
event.cpython-36.opt-1.pyc File 1.97 KB 0644
event.cpython-36.pyc File 1.97 KB 0644
features.cpython-36.opt-1.pyc File 1.47 KB 0644
features.cpython-36.pyc File 1.47 KB 0644
gpg.cpython-36.opt-1.pyc File 3.76 KB 0644
gpg.cpython-36.pyc File 3.76 KB 0644
helpers.cpython-36.opt-1.pyc File 13.31 KB 0644
helpers.cpython-36.pyc File 13.31 KB 0644
importer.cpython-36.opt-1.pyc File 1.68 KB 0644
importer.cpython-36.pyc File 1.68 KB 0644
log.cpython-36.opt-1.pyc File 4.61 KB 0644
log.cpython-36.pyc File 4.61 KB 0644
netinfo.cpython-36.opt-1.pyc File 12.67 KB 0644
netinfo.cpython-36.pyc File 12.67 KB 0644
persistence.cpython-36.opt-1.pyc File 2.82 KB 0644
persistence.cpython-36.pyc File 2.82 KB 0644
registry.cpython-36.opt-1.pyc File 1.38 KB 0644
registry.cpython-36.pyc File 1.38 KB 0644
safeyaml.cpython-36.opt-1.pyc File 8 KB 0644
safeyaml.cpython-36.pyc File 8 KB 0644
settings.cpython-36.opt-1.pyc File 1.14 KB 0644
settings.cpython-36.pyc File 1.14 KB 0644
signal_handler.cpython-36.opt-1.pyc File 1.58 KB 0644
signal_handler.cpython-36.pyc File 1.58 KB 0644
simpletable.cpython-36.opt-1.pyc File 2.53 KB 0644
simpletable.cpython-36.pyc File 2.53 KB 0644
ssh_util.cpython-36.opt-1.pyc File 15.36 KB 0644
ssh_util.cpython-36.pyc File 15.36 KB 0644
stages.cpython-36.opt-1.pyc File 25.15 KB 0644
stages.cpython-36.pyc File 25.15 KB 0644
subp.cpython-36.opt-1.pyc File 9.97 KB 0644
subp.cpython-36.pyc File 9.97 KB 0644
temp_utils.cpython-36.opt-1.pyc File 2.81 KB 0644
temp_utils.cpython-36.pyc File 2.81 KB 0644
templater.cpython-36.opt-1.pyc File 4.55 KB 0644
templater.cpython-36.pyc File 4.55 KB 0644
type_utils.cpython-36.opt-1.pyc File 437 B 0644
type_utils.cpython-36.pyc File 437 B 0644
url_helper.cpython-36.opt-1.pyc File 21.03 KB 0644
url_helper.cpython-36.pyc File 21.03 KB 0644
user_data.cpython-36.opt-1.pyc File 8.25 KB 0644
user_data.cpython-36.pyc File 8.25 KB 0644
util.cpython-36.opt-1.pyc File 73.64 KB 0644
util.cpython-36.pyc File 73.64 KB 0644
version.cpython-36.opt-1.pyc File 429 B 0644
version.cpython-36.pyc File 429 B 0644
warnings.cpython-36.opt-1.pyc File 3.25 KB 0644
warnings.cpython-36.pyc File 3.25 KB 0644