CasperSecurity

Current Path : /lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/__pycache__/atomic_helper.cpython-310.pyc

o

쑛h,�@s�ddlZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
dZe�e
�Ze	�d�dd��Ze	�d�d	d
��Zeddfd
d�Zeddfdd�Zdd�Ze	�d�dd��Zefdd�ZdS)�N)�	b64decode�	b64encode)�performance�utili�zBase64 decodingcCs,t|�}z|�d�WSty|YSw)z�base64 decode data

    :param source: a bytes or str to decode
    :return: base64 as a decoded str if utf-8 encoded, otherwise bytes
    �utf-8)r�decode�UnicodeDecodeError)�source�decoded�r�9/usr/lib/python3/dist-packages/cloudinit/atomic_helper.py�b64ds�r
zBase64 encodingcCs"t|t�s
|�d�}t|��d�S)zdbase64 encode data

    :param source: a bytes or str to decode
    :return: base64 encoded str
    r)�
isinstance�bytes�encoderr)r	rrr�b64es

r�wbFcCsDt�d|����t|||||�Wd�S1swYdS)zCopen filename in mode omode, write content, set permissions to modezWriting N)r�Timed�_write_file)�filename�content�mode�omode�
preserve_moderrr�
write_file*s$�rc	
Cs�|rz
t�|�}t�|j�}Wn	tyYnwd}z:tj�|�}t�|�t	j
|d|d�}t�d||j
||t|��|�|�|��t�|j
|�t�|j
|�WdStym}z|durgt�|j
�|�d}~ww)NF)�dir�deleterzOAtomically writing to file %s (via temporary file %s) - %s: [%o] %d bytes/chars)�os�stat�S_IMODE�st_mode�OSError�path�dirnamer�
ensure_dir�tempfile�NamedTemporaryFile�LOG�debug�name�len�write�close�chmod�rename�	Exception�unlink)	rrrrr�	file_stat�tfr#�errrr3s<
�
�
	��rcCs2zd�t|��WStyd�t|��YSw)z1Handler for types which aren't json serializable.z
ci-b64:{0}z)Warning: redacted unserializable type {0})�formatr�AttributeError�type)�_objrrr�json_serialize_defaultUs
�r8zDumping jsoncCstj|dddtd�S)z%Return data in nicely formatted json.�T)�,z: )�indent�	sort_keys�
separators�default)�json�dumpsr8)�datarrr�
json_dumps]s�rBcCst|t|�dd|d�S)N�
�w)rr)rrB)rrArrrr�
write_jsonis
�rE)r?�loggingrrr%�base64rr�	cloudinitrr�
_DEF_PERMS�	getLogger�__name__r'�timedr
rrrr8rBrErrrr�<module>s*



�

�"

Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY