CasperSecurity

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

o

쑛h��@s�dZddlZddlmmmZddlmZm	Z	mZm
Z
ddlmZddl
mZe�e�ZdZededd	�Zd
ZdZdZGdd
�d
ej�Zdd�ZeejffgZdd�ZdS)z;Hetzner Cloud API Documentation
https://docs.hetzner.cloud/�N)�dmi�net�sources�util)�NoDHCPLeaseError)�EphemeralDHCPv4z!http://169.254.169.254/hetzner/v1z	/metadataz	/userdata)�metadata_url�userdata_url�<�c@s4eZdZdZdd�Zdd�Zdd�Zedd	��Zd
S)�DataSourceHetzner�HetznercCs�tj�||||�||_t�|_t�t�|ddgi�t	g�|_
|j
d|_|j
d|_|j
�
dt�|_|j
�
dt�|_|j
�
dt�|_tj|_tj|_d|_dS)N�
datasourcer
rr	�retries�timeout�
wait_retry)r�
DataSource�__init__�distro�dict�metadatar�
mergemanydict�get_cfg_by_path�BUILTIN_DS_CONFIG�ds_cfg�metadata_address�userdata_address�get�
MD_RETRIESr�
MD_TIMEOUTr�
MD_WAIT_RETRYr�UNSET�_network_config�DSMODE_NETWORK�dsmode�
metadata_full)�self�sys_cfgr�paths�r)�E/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceHetzner.pyr"s ��
zDataSourceHetzner.__init__c
CsPt�\}}|s	dSzJt|jt��dtdigd��1tj|j|j	|j
|jd�}tj|j
|j	|j
|jd�}tj|jd|j	|j
|jd�}Wd�n1sMwYWntyf}zt�d|��d}~wwt�|�|_||_|d|jd<|d	|jd
<|�dd�|jd<|�dd�|jd<||jd
<|�dd�|_|��|kr�td��dS)NF�urlz/metadata/instance-id)�iface�connectivity_urls_data)r�sec_betweenrz/private-networkszBailing, DHCP Exception: %szinstance-id�hostnamezlocal-hostname�network-configzpublic-keyszprivate-networks�vendor_dataz6SMBIOS serial does not match instance ID from metadataT)�get_hcloud_datarrr�find_fallback_nic�BASE_URL_V1�	hc_helper�
read_metadatarrrr�
read_userdatarr�LOG�errorr�maybe_b64decode�userdata_rawr%rr�vendordata_raw�get_instance_id�RuntimeError)r&�
on_hetzner�serial�md�ud�pn�er)r)r*�	_get_data5sb
���	�������
�zDataSourceHetzner._get_datacCst�|��d�S)N�system-serial-number)r�instance_id_matches_system_uuidr=)r&r'r)r)r*�check_instance_idws�z#DataSourceHetzner.check_instance_idcCsT|jdurt�dtj�tj|_|jtjkr|jS|jd}|s$td��||_|jS)z�Configure the networking. This needs to be done each boot, since
        the IP information may have changed due to snapshot and/or
        migration.
        Nz5Found None as cached _network_config. Resetting to %sr0z'Unable to get meta-data from server....)r"r8�warningrr!rr>)r&�_net_configr)r)r*�network_config|s
�
z DataSourceHetzner.network_configN)	�__name__�
__module__�__qualname__�dsnamerrErH�propertyrKr)r)r)r*rsBrcCs@t�d�}|dkrdSt�d�}|rt�d|�d|fStd��)Nzsystem-manufacturerr
)FNrFz#Running on Hetzner Cloud: serial=%sz+Hetzner Cloud detected, but no serial foundT)r�
read_dmi_datar8�debugr>)�vendor_namer@r)r)r*r2�s

�r2cCst�|t�S)N)r�list_from_depends�datasources)�dependsr)r)r*�get_datasource_list�srW)�__doc__�logging�!cloudinit.sources.helpers.hetznerr�helpers�hetznerr5�	cloudinitrrr�cloudinit.net.dhcpr�cloudinit.net.ephemeralr�	getLoggerrLr8r4rrrr rrr2�DEP_FILESYSTEMrUrWr)r)r)r*�<module>s&
�x
�
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