403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.6/site-packages/cloudinit/cmd/devel/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/cmd/devel/__pycache__/make_mime.cpython-36.pyc
3

��b��@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZd	Z
eje
�Zd
Zdd�Zd
d�Zddd�Zddd�Zdd�Zdd�Zedkr�eje��dS)z0Generate multi-part mime messages for user-data �N)�
MIMEMultipart)�MIMEText)�log)�INCLUSION_TYPES_MAP�)�addLogHandlerCLIz	make-mimezUExample: make-mime -a config.yaml:cloud-config -a script.sh:x-shellscript > user-datacCs�g}g}x|t|�D]p\}\}}}|j�}t||tj��}|jdd|�|j�j�}	|	t�krxd|	|df}
|j	|
�|j	|�qWt
�}x|D]}
|j|
�q�W||fS)NzContent-Dispositionzattachment; filename="%s"z3content type %r for attachment %s may be incorrect!r)�	enumerate�readr�sys�getdefaultencodingZ
add_headerZget_content_type�lower�get_content_types�appendrZattach)�filesZsub_messages�errors�iZfh�filenameZformat_type�contentsZsub_message�content_type�msg�combined_message�r�/usr/lib/python3.6/make_mime.py�create_mime_messages"


rcCs^y$|jdd�\}}t|d�||j�fStk
rX}ztj|d|�|�WYdd}~XnXdS)z@Return file content type by reading the first line of the input.�:r�rzInvalid value for %rN)�split�open�strip�
ValueError�argparseZ
ArgumentError)�textrr�errr�file_content_type-s
r#c
Cs^|stj�}t|_t|_|jdddtdgddd�|jdd	d
ddd
�|jddd
ddd
�|S)aBuild or extend and arg parser for make-mime utility.

    @param parser: Optional existing ArgumentParser instance representing the
        subcommand which will be extended to support the args of this utility.

    @returns: ArgumentParser with proper argument configuration.
    z-az--attachrrz<file>:<content-type>z3attach the given file as the specified content-type)�dest�type�action�default�metavar�helpz-lz--list-types�
store_trueFz&List support cloud-init content types.)r&r'r)z-fz--forcez$Ignore unknown content-type warnings)r �ArgumentParser�__doc__�description�EPILOGZepilog�add_argumentr#)�parserrrr�
get_parser8s4r1Fcst�fdd�tj�D��S)z�Return a list of cloud-init supported content types.  Optionally
    strip out the leading 'text/' of the type if strip_prefix=True.
    cs g|]}�r|jdd�n|�qS)ztext/�)�replace)�.0Zctype)�strip_prefixrr�
<listcomp>fsz%get_content_types.<locals>.<listcomp>)�sortedr�values)r5r)r5rr
`s
r
cCs�tt|jrtjntj�|jr6tdjt	dd���dSt
|j�\}}|r�|jrRdnd}x$|D]}t
jj|�d|�d��q\Wt
jjd�|js�d	St|�dS)
a<Create a multi-part MIME archive for use as user-data.  Optionally
       print out the list of supported content types of cloud-init.

    Also setup CLI log handlers to report to stderr since this is a development
    utility which should be run by a human on the CLI.

    @return 0 on success, 1 on failure.
    �
T)r5r�WARNINGZERRORz: z-Invalid content-types, override with --force
r)r�LOG�debugr�DEBUGr:Z
list_types�print�joinr
rr�forcer
�stderr�write)�name�argsrr�level�errorrrr�handle_argsls	
rGcCst�j�}tt|�S)N)r1�
parse_argsrG�NAME)rDrrr�main�s
rJ�__main__)N)F)r,r r
Zemail.mime.multipartrZemail.mime.textrZ	cloudinitrZcloudinit.handlersrr2rrIZ	getLoggerr;r.rr#r1r
rGrJ�__name__�exitrrrr�<module>s$

(


Youez - 2016 - github.com/yon3zu
LinuXploit