CasperSecurity

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

o

쑛ht�@s�ddlZddlZddlmZddlmZmZddlmZddl	m
Z
mZe�e
�ZGdd�dej�ZeZeejffgZdd	�ZdS)
�N)�	b64decode)�dmi�sources)�DataSourceHostname)�SERIAL_PORT�Cepkoc@sReZdZdZdZdd�Zedd��Zdd�Zd	d
�Z	ddd
�Z
dd�Zdd�ZdS)�DataSourceCloudSigmaz�
    Uses cepko in order to gather the server context from the VM.

    For more information about CloudSigma's Server Context:
    http://cloudsigma-docs.readthedocs.org/en/latest/server_context.html
    �
CloudSigmacCs$t�|_d|_tj�||||�dS)N�)r�cepko�ssh_public_keyr�
DataSource�__init__)�self�sys_cfg�distro�paths�r�H/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudSigma.pyrszDataSourceCloudSigma.__init__cCs>t�d�t�d�}|st�d�dSt�d|�d|��vS)z
        Uses dmi data to detect if this instance of cloud-init is running
        in the CloudSigma's infrastructure.
        z0determining hypervisor product name via dmi datazsystem-product-namez-system-product-name not available in dmi dataFzdetected hypervisor as %s�
cloudsigma)�LOG�debugr�
read_dmi_data�lower)�sys_product_namerrr�	ds_detect!s


zDataSourceCloudSigma.ds_detectcCs�d}z|j��j}|d}Wntyt�d�YdSw|�|�d�g�|_|t	j
kr/dS|�dd��d�}|�d	d�|_d	|vrIt
|j�|_d
|�di�vrX|dd
|_||_|d|_d
S)zj
        Metadata is the whole server context and /meta/cloud-config is used
        as userdata.
        N�metaz+CloudSigma: Unable to read from serial portFzcloudinit-dsmode�
base64_fieldsr
�,zcloudinit-user-data�	cloudinit�vendor_datarT)r�all�result�	Exceptionrr�_determine_dsmode�get�dsmoder�DSMODE_DISABLED�split�userdata_rawr�vendordata_raw�metadatar)rr&�server_context�server_metarrrr�	_get_data0s,
�
�

zDataSourceCloudSigma._get_datacCsdtS)z/Return the subplatform metadata source details.z
cepko (%s))r�rrrr�_get_subplatformRsz%DataSourceCloudSigma._get_subplatformFcCsDt�d|jd�r|jddd�}n
|jd�d�d}t|d�S)	z�
        Cleans up and uses the server's name if the latter is set. Otherwise
        the first part from uuid is being used.
        z^[A-Za-z0-9 -_\.]+$�nameN�=�uuid�-rF)�re�matchr+r(r)r�fqdn�
resolve_ip�
metadata_only�retrrr�get_hostnameVs
z!DataSourceCloudSigma.get_hostnamecCs|jgS)N)rr/rrr�get_public_ssh_keysasz(DataSourceCloudSigma.get_public_ssh_keyscCs
|jdS)Nr3)r+r/rrr�get_instance_idds
z$DataSourceCloudSigma.get_instance_idN)FFF)
�__name__�
__module__�__qualname__�__doc__�dsnamer�staticmethodrr.r0r;r<r=rrrrrs
"
rcCst�|t�S)zK
    Return a list of data sources that match this set of dependencies
    )r�list_from_depends�datasources)�dependsrrr�get_datasource_listrsrG)�loggingr5�base64rrrr�cloudinit.sourcesr�$cloudinit.sources.helpers.cloudsigmarr�	getLoggerr>rr
r�DataSourceCloudSigmaNet�DEP_FILESYSTEMrErGrrrr�<module>s
W
�
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