CasperSecurity

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

o

쑛h��@s�ddlZddlZddlmZddlmZmZmZmZe�	e
�ZdgZdZ
dZGdd�dej�Zd	efd
d�Zdefd
d�ZeejejffgZdd�ZdS)�N)�Optional)�dmi�sources�
url_helper�utilzhttp://169.254.169.254��CloudCIXcsleZdZdZdZdZdZ�fdd�Zdd�Zde	fd	d
�Z
deefdd�Z
ed
d��Zedd��Z�ZS)�DataSourceCloudCIXr��cs$tt|��|||�d|_d|_dS�N)�superr	�__init__�
_metadata_url�_net_cfg)�self�sys_cfg�distro�paths��	__class__��F/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudCIX.pyrs
zDataSourceCloudCIX.__init__c
Cs`z|��}Wntjy }z
t�d|�WYd}~dSd}~ww|d|_t�|d�|_dS)z6
        Fetch the user data and the metadata
        z0Failed to read data from CloudCIX datasource: %sNF�	meta-data�	user-dataT)	�crawl_metadata_servicer�InvalidMetaDataException�LOG�error�metadatar�
decode_binary�userdata_raw)r�crawled_datarrrr�	_get_datas���
zDataSourceCloudCIX._get_data�returncCs,|��}|dur
t�d��t||���}|S)Nz Could not determine metadata URL)�determine_md_urlrr�
read_metadata�get_url_params)r�md_url�datarrrr/s�z)DataSourceCloudCIX.crawl_metadata_servicecCs�|jr|jS|��}tjt|j|jd�\}}|sdSttdd�D]I}t�	|d�
|�d�}z
tj||jd�}Wntj
yP}z
t�d||�WYd}~q d}~ww|��rct�	|d�
|��|_|jSt�d|�q |jS)	N)�max_wait�timeoutr���zv{0}r)r+zURL %s raised exception %szNo metadata found at URL %s)rr'r�wait_for_url�
METADATA_URLS�max_wait_seconds�timeout_seconds�range�METADATA_VERSION�combine_url�format�readurl�url_timeout�UrlErrorr�debug�ok)r�
url_params�base_url�_�version�url�response�errrr%9s:
����
��z#DataSourceCloudCIX.determine_md_urlcCst�Sr)�is_platform_viablerrrr�	ds_detect\szDataSourceCloudCIX.ds_detectcCs(|jr|jS|jsdS|jd|_|jS)N�network)rr)rrrr�network_config`sz!DataSourceCloudCIX.network_config)�__name__�
__module__�__qualname__�dsname�url_retries�url_timeout_seconds�url_sec_between_retriesrr#�dictrr�strr%�staticmethodrB�propertyrD�
__classcell__rrrrr	s
#
r	r$cCst�d�tkS)Nzsystem-product-name)r�
read_dmi_data�CLOUDCIX_DMI_NAMErrrrrAksrAr;c
Cs
i}ddtjfddtjff}|D]r\}}}ztjt�||�|j|j|jd�}Wntj	yE}zt
�d|�d|�d|�d|����d	}~ww|��s\t
�d
|�d|�d|�d|j
����z	||j�||<Wqtjjy�}	zt
�d
|�d|�d|	���|	�d	}	~	ww|S)a;
    Read metadata from metadata server at base_url

    :returns: dictionary of retrieved metadata and user data containing the
              following keys: meta-data, user-data
    :param: base_url: meta data server's base URL
    :param: url_params: dictionary of URL retrieval parameters. Valid keys are
            `retries`, `sec_between` and `timeout`.
    :raises: InvalidMetadataException upon network error connecting to metadata
             URL, error response from meta data server or failure to
             decode/parse metadata and userdata payload.
    rr�userdatar)r>�retries�sec_betweenr+zFailed to fetch IMDS z: �/Nz	No valid z found. URL z returned code zInvalid JSON at )r�	load_json�maybe_b64decoderr5r3�num_retries�sec_between_retriesr0r7rrr9�code�contents�json�decoder�JSONDecodeError)
r;r:�md�leaf_key_format_callback�url_leaf�new_key�format_callbackr?r�excrrrr&osZ

�

���������������r&cCst�|t�Sr)r�list_from_depends�datasources)�dependsrrr�get_datasource_list�sri)r]�logging�typingr�	cloudinitrrrr�	getLoggerrErr.r2rR�
DataSourcer	�boolrArMr&�DEP_FILESYSTEM�DEP_NETWORKrgrirrrr�<module>s
Z2�
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