shell bypass 403

Cubjrnet7 Shell


name : user_data.cpython-39.pyc
a

'�Dg�9�@s�ddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZmZe�e�ZejZejZejZdZd	d
gZddgZd
gZd	ZdZdZgd�ZdZdgZ dd�Z!dd�Z"ddd�Z#Gdd�d�Z$dd�Z%efdd�Z&dS)�N)�MIMEBase)�
MIMEMultipart)�MIMENonMultipart)�MIMEText)�features�handlers�util)�UrlError�read_file_or_urlzContent-Typez
text/plainztext/x-not-multipartztext/x-include-urlztext/x-include-once-urlztext/cloud-config-archiveztext/cloud-configzapplication/octet-stream)zapplication/gzipzapplication/gzip-compressedzapplication/gzippedzapplication/x-compresszapplication/x-compressedzapplication/x-gunzipzapplication/x-gzipzapplication/x-gzip-compressedzNumber-AttachmentscCs||=|||<dS�N�)�msg�key�valuerr�7/usr/lib/python3.9/site-packages/cloudinit/user_data.py�_replace_header;srcCs|d=|jddt|�d�dS)NzContent-DispositionZ
attachment)�filename)�
add_header�str)r
rrrr�
_set_filename@srcCs tjrt|�|�n
t�|�dSr)rZERROR_ON_USER_DATA_FAILURE�RuntimeError�LOGZwarning)�
error_messageZsource_exceptionrrr�
_handle_errorEsrc@s^eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
ddd�Zdd�ZdS)�UserDataProcessorcCs||_t�|�|_dSr)�pathsrZfetch_ssl_details�ssl_details)�selfrrrr�__init__MszUserDataProcessor.__init__cCs@t�}t|t�r,|D]}|�t|�|�qn|�t|�|�|Sr)r�
isinstance�list�_process_msg�convert_string)rZblobZaccumulating_msg�brrr�processQs
zUserDataProcessor.processcCs�dd�}|��D�]�}t|�r qd}|��}t�|�}d}|tvr�ztj|dd�}d}d}WnNtjy�}	z4d�|t	|�|	�}
t
|
|	�WYd}	~	qWYd}	~	n
d}	~	00|s�t}|tdgvr�||�}|dur�|}|�rF|�
dd	�\}}t||�}
|
�|�|���rt|
|���d
D]$}||v�rt|
|t||���q|
}||k�r\t|t|�|tv�rt|�||�q|tv�r�|�||�qt|t|�|�||�qdS)NcSs
t�|�Sr)r�type_from_starts_with)�payloadrrr�
find_ctype[sz2UserDataProcessor._process_msg.<locals>.find_ctypeF)�quietTz<Failed decompressing payload from {} of length {} due to: {}ztext/x-shellscript�/�)�Launch-Index)�walk�is_skippable�get_content_typerZfully_decoded_payload�DECOMP_TYPES�decomp_gzipZDecompressionError�format�lenr�
UNDEF_TYPE�TYPE_NEEDED�splitr�set_payload�get_filenamerrr�CONTENT_TYPE�
INCLUDE_TYPES�_do_include�
ARCHIVE_TYPES�_explode_archive�_attach_part)rZbase_msg�
append_msgr'�partZctypeZ
ctype_origr&Zwas_compressed�er�maintype�subtypeZn_part�hrrrr!Zs\

��
"






zUserDataProcessor._process_msgc	Cs�|�dd�}d}|��tvrTz$t�|jdd��}|r>|�d�}WntyRYn0|dur`|}|durl|}|dur�z|�dtt	|���Wnt
tfy�Yn0dS)Nr+T��decode�launch-index)�getr.�EXAMINE_FOR_LAUNCH_INDEXr�	load_yamlZget_payload�	Exceptionrr�int�
ValueError�	TypeError)rr
Z
header_idxZpayload_idxr&rrr�_attach_launch_index�s$z&UserDataProcessor._attach_launch_indexcCs&t�|dd�}tj�|j�d�d|�S)NZmd5�@�dataZurlcache)rZ	hash_blob�os�path�joinrZ
get_ipath_cur)r�entryZentry_fnrrr�_get_include_once_filename�s�z,UserDataProcessor._get_include_once_filenamecCs$|��st|t|�|�|�dSr)r7r�PART_FN_TPLrN)rr
Zattached_idrrr�_process_before_attach�sz(UserDataProcessor._process_before_attachcCs�d}|��D�]�}|��}|�d�r>|td�d���}d}n"|�d�r`|td�d���}d}|�d�rlq|��}|szqd}d}|r�|�|�}|r�tj�	|�r�t
�|�}n�zZt|dd|j
d�}|r�|��r�t
j||jd	d
�|��r�|j}nd�||j�}	t|	�Wn�t�yV}
z6t|
�}||v�r8|d�|�7}t||
�WYd}
~
nDd}
~
0t�y�}z"d
�||�}	t|	|�WYd}~n
d}~00|durt|�}
|�|
|�qdS)NFz
#include-onceTz#include�#��
)�timeoutZretriesri�)�modez6Fetching from {} resulted in a invalid http code of {}z
 for url: {0}zFetching from {} resulted in {})�
splitlines�lower�
startswithr2�lstrip�striprUrQrR�isfilerZload_text_filer
r�okZ
write_file�contentsr1�coderr	r�IOErrorr"r!)r�contentr>Zinclude_once_on�lineZlc_lineZinclude_urlZinclude_once_fnZresprZurle�messageZioeZnew_msgrrrr:�sf



����
� zUserDataProcessor._do_includecCsLtj|gttfd�}|D�],}t|t�r0d|i}t|t�s<q|�dd�}|�d�}|stt}t|t	�rht
}t�||�}|�
dd�\}}	|dkr�t|t	�r�|��}t||	d�}
nt||	�}
|
�|�d	|vr�t|
|d	�d
|vr�|
�dt|d
��t|���D]:}|��dd	dd
dt��t��fv�r(q�|
�|||�q�|�||
�qdS)
N)�default�allowedrg��typer)r*�text)Z_subtyperrFr+zcontent-disposition)rrIr �setrr�dictrG�ARCHIVE_UNDEF_TYPE�bytes�ARCHIVE_UNDEF_BINARY_TYPErr%r5rErrr6rr�keysr^�ATTACHMENT_FIELDr8r=)r�archiver>�entriesZentrgZmtyperjrArBr
�headerrrrr<sJ







�	z"UserDataProcessor._explode_archiveNc	Csjt|vrd|t<|dur(t|tt|��d}zt|�t��}Wn&ttfydt|tt|��Yn0|S)z
        Return the number of attachments to this MIMEMultipart by looking
        at its 'Number-Attachments' header.
        �0Nr)rurrrKrGrLrM)r�	outer_msgZ	new_countZ
fetched_countrrr�_multi_part_countFsz#UserDataProcessor._multi_part_countcCs8|�|�}|�||d�|�|�|�||d�dS)z�
        Attach a message to an outer message. outermsg must be a MIMEMultipart.
        Modifies a header in the outer message to keep track of number of
        attachments.
        r*N)r{rWZattach)rrzr?Z
part_countrrrr=Xs

zUserDataProcessor._attach_part)N)
�__name__�
__module__�__qualname__rr$r!rNrUrWr:r<r{r=rrrrrLs	PE4
rcCs |��p
d}|��dkrdSdS)NrlZ	multipartTF)Zget_content_maintyper^)r?Z
part_maintyperrrr-dsr-cCsl|sd}dd�}t|t�r&|�d�}n|}tj|dd�}d|dd	���vr^t�|�d��}n
|||�}|S)
zJconvert a string (more likely bytes) or a message into
    a mime message.�cSs(|�dd�\}}t||�}|�|�|S)Nr)r*)r5rr6)rP�content_typerArBr
rrr�
create_binmsgss

z%convert_string.<locals>.create_binmsgzutf-8FrDs
mime-version:ri)rr�encoderr0r^Zmessage_from_stringrE)�raw_datar�r�Zbdatar
rrrr"ms

r")N)'ZloggingrQZemail.mime.baserZemail.mime.multipartrZemail.mime.nonmultipartrZemail.mime.textrZ	cloudinitrrrZcloudinit.url_helperr	r
Z	getLoggerr|rZNOT_MULTIPART_TYPErVZ
OCTET_TYPEr8r4r9r;r3rqrsr/rurHrrrrr-r"rrrr�<module>s:

	

© 2025 Cubjrnet7