CasperSecurity

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

o

쑛h��@s�ddlZddlmZddlmZmZddlmZddlm	Z	ddl
mZe�
e�ZddiZd	Zd
Zd
ZGdd�dej�ZGd
d�de�ZeejffeejejffgZdd�ZdS)�N)�net)�sources�util)�NoDHCPLeaseError)�EphemeralDHCPv4)�upcloud�metadata_urlz'http://169.254.169.254/metadata/v1.json��c@sHeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	e
d
d��ZdS)�DataSourceUpCloud�UpCloudFcCs�tj�||||�||_t�|_t�t�|ddgi�t	g�|_
|j
d|_|j
�dt
�|_|j
�dt�|_|j
�dt�|_d|_d|_dS)N�
datasourcerr�retries�timeout�
wait_retry)r�
DataSource�__init__�distro�dict�metadatar�
mergemanydict�get_cfg_by_path�BUILTIN_DS_CONFIG�ds_cfg�metadata_address�get�
MD_RETRIESr�
MD_TIMEOUTr�
MD_WAIT_RETRYr�_network_config�
metadata_full)�self�sys_cfgr�paths�r$�E/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceUpCloud.pyr"s��
zDataSourceUpCloud.__init__cCst��S�N)�	uc_helper�read_sysinfo�r!r$r$r%�_get_sysinfo3szDataSourceUpCloud._get_sysinfocCstj|j|j|j|jd�S)N)r�sec_betweenr)r'�
read_metadatarrrrr)r$r$r%�_read_metadata6s�z DataSourceUpCloud._read_metadatac
Cs�|��\}}|s
dSt�d|�|jr]z+t�d�t��}t�d|�t|j|��|�	�}Wd�n1s8wYWnLt
tjfy\}zt
�tt|��WYd}~dSd}~wwzt�d�|�	�}Wn"tjy�}zt
�tt|��t�d|�WYd}~dSd}~ww||_|�d|�|jd<|�d	�|jd
<|�d�|jd<|�d�|jd
<|�dd�|jd<|�dd�|_|�dd�|_dS)NFz"Running on UpCloud. server_uuid=%szFinding a fallback NICz*Discovering metadata via DHCP interface %sz7Discovering metadata without DHCP-configured networkingzENo DHCP-enabled interfaces available, unable to fetch metadata for %s�instance_idzinstance-id�hostnamezlocal-hostname�network�public_keyszpublic-keys�region�default�availability_zone�vendor_data�	user_dataT)r*�LOG�info�perform_dhcp_setup�debug�cloudnet�find_fallback_nicrrr-rr�InvalidMetaDataExceptionr�logexc�strr rr�vendordata_raw�userdata_raw)r!�
is_upcloud�server_uuid�nic�md�er$r$r%�	_get_data>sR

��������	zDataSourceUpCloud._get_datacCst�|���Sr&)r�instance_id_matches_system_uuid�get_instance_id)r!r"r$r$r%�check_instance_idksz#DataSourceUpCloud.check_instance_idcCs6|jr|jS|j�d�}|std��t�|�|_|jS)z�
        Configure the networking. This needs to be done each boot,
        since the IP and interface information might have changed
        due to reconfiguration.
        r0z/Unable to get network meta-data from server....)rrr�RuntimeErrorr'�convert_network_config)r!�raw_network_configr$r$r%�network_configns��z DataSourceUpCloud.network_configN)�__name__�
__module__�__qualname__�dsnamer9rr*r-rGrJ�propertyrNr$r$r$r%rs-rc@seZdZdZdZdS)�DataSourceUpCloudLocalaz
    Run in init-local using a DHCP discovery prior to metadata crawl.

    In init-local, no network is available. This subclass sets up minimal
    networking with dhclient on a viable nic so that it can talk to the
    metadata service. If the metadata service provides network configuration
    then render the network configuration for that instance based on metadata.
    TN)rOrPrQ�__doc__r9r$r$r$r%rT�s	rTcCst�|t�Sr&)r�list_from_depends�datasources)�dependsr$r$r%�get_datasource_list�srY)�logging�	cloudinitrr;rr�cloudinit.net.dhcpr�cloudinit.net.ephemeralr�cloudinit.sources.helpersrr'�	getLoggerrOr7rrrrrrrT�DEP_FILESYSTEM�DEP_NETWORKrWrYr$r$r$r%�<module>s"
k
�
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