403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3.9/site-packages/cfnbootstrap/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/cfnbootstrap/__pycache__/sources_tool.cpython-39.opt-1.pyc
a

��0i��@s�ddlmZddlmZddlmZddlmZddlm	Z	ddl
Z
ddlZddlm
Z
ddlZddlmZddlZddlZddlZddlZe
�d	�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZdS)�)�util)�	ToolError)�retry_on_failure)�TarError)�
BadZipfileN)�chmod)�requestszcfn.initc@sNeZdZdZe�dej�Ze�d�Zdd�Z	dd�Z
dd	�Ze�d
d��Z
dS)
�SourcesToolz=
    Explodes sources (archives) into locations on disk

    z^(https?|ftp)://.*$z.^https?://github.com/.*?/(zipball|tarball)/.*$c	Cs`g}|st�d�|St|��dd�d�D�].\}}tj�|�r�z|�||�}Wq�ty�}zt	d||j
f��WYd}~q�d}~00n"tj�
|�s�t	d|��t|d�}t�|�r�t�d	|�t|�}n,t�|�r�t�d
|�t|�}nt	d|��t�d|�|�||�tj�|����r8t�d
�|�|�}t�d||�|�|�|�|�q*|S)a�
        Extract archives to their corresponding destination directories, returning directories which were updated.

        Arguments:
        action -- a dict of directory to archive location, which can be either a path or URL
        auth_config -- an AuthenticationConfig object for managing authenticated downloads

        Exceptions:
        ToolError -- on expected failures
        zNo sources specifiedcSs|dS)Nr�)Zpairr
r
�=/usr/lib/python3.9/site-packages/cfnbootstrap/sources_tool.py�<lambda>>�z#SourcesTool.apply.<locals>.<lambda>)�keyzFailed to retrieve %s: %sNz%s does not exist�rbzTreating %s as a tarballzTreating %s as a zip archivez0Unsupported source file (not zip or tarball): %sz>Checking to ensure that all archive members fall under path %szBAttempting to magically strip GitHub parent directory from archivezExpanding %s into %s)�log�debug�sorted�itemsr	�_remote_pattern�match�_archive_from_url�IOErrorr�strerror�os�path�isfile�open�
TarWrapper�
is_compatible�
ZipWrapper�_check_all_members_in_path�_github_pattern�lower�_perform_github_magic�extract_all�append)	�self�action�auth_configZdirs_changedr�archiveZarchive_file�eZarchive_wrapperr
r
r�apply,sJ
�




���

zSourcesTool.applyc
Cs�t��}z�|�|�t�|�}t|�dkrFt�d�|Wt�	|d�St�
�}tj|dd�}tj
�||d�}t�d|�t�|�D]}|jtj
�||�|d�q�|��|�dd�t|�Wt�	|d�SWt�	|d�nt�	|d�0d	S)
au
        The tarballs that GitHub autogenerates via their HTTP API put the contents
        of the tree into a top-level directory that has no value or predictability.
        This essentially "strips" that top level directory -- unfortunately, python has no
        equivalent of tar's --strip-components.  So we unarchive it and then rearchive
        a subtree.
        �zLGitHub magic is not possible; archive does not contain exactly one directoryT�w�Zfileobj�moderzCreating temporary tar from %s)ZarcnameN)�tempfileZmkdtempr$r�listdir�lenrr�shutilZrmtree�
TemporaryFile�tarfileZTarFiler�join�add�close�seekr)r&r)ZtempdirZtempmembersZtemparchive�tf�parent�memberr
r
rr#ds.

���z!SourcesTool._perform_github_magiccCs�tj�tj�|��}|��D]t}tj�|�rNtj�tj�tj�|��|g�}n*tj�tj�tj�tj�||���|g�}||krt	d||f��qdS)z�
        This does a best-effort test to make sure absolute paths
        or ../../../../ nonsense in archives makes files "escape"
        their destination
        z%s is not a sub-path of %sN)
rr�normcase�abspath�files�isabs�commonprefix�normpathr6r)r&rr)Znormalized_parentr<�prefixr
r
rr �s���z&SourcesTool._check_all_members_in_pathcCsTt��}t�d|�d�i�}t�tj|fi|����|�|�	�|�
dtj�|S)NZauthr)
r0r4rZreq_optsZget_authZEtagCheckedResponser�getZwrite_to�flushr9r�SEEK_SET)r&r)r(r:Zoptsr
r
rr�szSourcesTool._archive_from_urlN)�__name__�
__module__�__qualname__�__doc__�re�compile�Irr!r+r#r rrr
r
r
rr	"s�8r	c@s0eZdZdd�Zedd��Zdd�Zdd�Zd	S)
rcCstj|dd�|_dS)N�r�r/)�zipfile�ZipFile�file�r&�fr
r
r�__init__�szZipWrapper.__init__cCsBz(tj|dd�}|��|�dd�WdSty<YdS0dS)NrNrOrTF)rPrQr8r9r)�clsrT�zr
r
rr�szZipWrapper.is_compatiblecCsdd�|j��D�S)Ncss|]}|jVqdS�N)�filename)�.0�infor
r
r�	<genexpr>�r
z#ZipWrapper.files.<locals>.<genexpr>)rR�infolist�r&r
r
rr?�szZipWrapper.filescCsD|j��D]4}|j}|d?}|j�||�}tjdkr
t||�q
dS)aR
        The zipfile module doesn't preserve file permissions when extracting, so
        each file needs to have its mode changed via chmod after extracting it.
        The file's original permission bits are stored in the external attributes of
        the file's ZipInfo object, and we retrieve them by shifting right 16 bits.
        ��ntN)rRr]Z
external_attr�extractr�namer)r&�destr[Zext_attrr/Ztarget_pathr
r
rr$�s
zZipWrapper.extract_allN�rGrHrIrU�classmethodrr?r$r
r
r
rr�s

	rc@s0eZdZdd�Zedd��Zdd�Zdd�Zd	S)
rcCstj|dd�|_dS)N�r:*r.)r5rrRrSr
r
rrU�szTarWrapper.__init__c
Cs`z(tj|dd�}|��|�dd�WdStyZ}zt�d|�WYd}~dSd}~00dS)Nrfr.rTzException opening tar: %sF)r5rr8r9rrr)rVrT�tr*r
r
rr�szTarWrapper.is_compatiblecCs
|j��SrX)rRZgetnamesr^r
r
rr?�szTarWrapper.filescCs|j�|�dSrX)rRZ
extractall)r&rcr
r
rr$�szTarWrapper.extract_allNrdr
r
r
rr�s


r)ZcfnbootstraprZ cfnbootstrap.construction_errorsrZcfnbootstrap.utilrr5rrPrZloggingZos.pathrrrKZcfnbootstrap.packagesrr3r0Z	getLoggerr�objectr	rrr
r
r
r�<module>s"
|#

Youez - 2016 - github.com/yon3zu
LinuXploit