403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.46
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__/DataSourceRbxCloud.cpython-36.pyc
3

?q,dL�@s�dZddlZddlZddlZddlmZddlmZmZm	Z	ddl
mZmZej
e�ZdZdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�ZGdd�dej�ZeejffgZdd�ZdS)zr
This file contains code used to gather the user data passed to an
instance on rootbox / hyperone cloud platforms
�N)�log)�sources�subp�util)�
EventScope�	EventTypez
/etc/hostscCs.tjtdd�}|r tjd�dStjd�dS)NT)�quietz5/etc/hosts exists - setting manage_etc_hosts to FalseFz=/etc/hosts does not exists - setting manage_etc_hosts to True)r�	load_file�	ETC_HOSTS�LOG�debug)Zhosts�r
�(/usr/lib/python3.6/DataSourceRbxCloud.py�get_manage_etc_hostss

rcCsF|jd�}t|d�d>t|d�d>t|d�d>t|d�S)	N�.r������)�split�int)�addr�partsr
r
r�ip2int!s
rcs&dj�fdd�td�ddd�D��S)Nrcs g|]}t�|d>?d@��qS)r�)�str)�.0�i)rr
r�
<listcomp>,szint2ip.<locals>.<listcomp>�r���)�join�range)rr
)rr�int2ip+sr%cCstjdg|�S)z�
    Uses the preferred cloud-init subprocess def of subp.subp
    and runs arping.  Breaking this to a separate function
    for later use in mocking and unittests
    Zarping)r)�cmdr
r
r�_sub_arp/sr'cCs�d}|jdkrd}xh|D]`}ytdd||d	|d
g�Wqtjk
rv}ztjd|d	|d
|�WYdd}~XqXqWdS)
Nz-S�	almalinux�fedora�centos�rhelz-sz-c�2�source�destinationz&Failed to arping from "%s" to "%s": %s)r(r)r*r+)�namer'rZProcessExecutionErrorrZwarning)�items�distroZsource_param�item�errorr
r
r�gratuitous_arp8s

r4cCs�ttjd�tjd��}|s dSx�|D]z}y"tj|tdddgd�}|rJ|SWq&tk
r|}z|jtjkrl�WYdd}~Xq&tjk
r�tj	t
d	|�Yq&Xq&Wt
jd
dj|��dS)zAReturns False (not found or error) or a dictionary with metadata.z
LABEL=CLOUDMDz
LABEL=cloudmdFZvfatZfatZmsdosfs)�device�callbackZmtypeNz-Failed to mount %s when looking for user dataz0Did not find RbxCloud data, searched devices: %s�,)
�setrZfind_devs_withZmount_cb�read_user_data_callback�OSError�errno�ENOENTZMountFailedError�logexcrrr#)Zdevicesr5�rbx_data�errr
r
r�get_mdMs,
r@cCsddd�t|�D�d�S)z�Generate network configuration

    @param netadps: A list of network adapter settings

    @returns: A dict containing network config
    rcsBg|]:\}�ddjt|���dj��fdd��dD�d��qS)Zphysicalzeth{}Z
macaddressc	s>g|]6}d|d�ddd�dd�dddd��qS)	Zstatic�address�network�netmask�auto�gatewayZdnsZnameservers)�typerArCZcontrolrEZdns_nameserversr
)r�ip)�netadpr
rr {s
z6generate_network_config.<locals>.<listcomp>.<listcomp>rG)rFr/Zmac_addressZsubnets)�formatr�lower)rrr
)rHrr vsz+generate_network_config.<locals>.<listcomp>)�version�config)�	enumerate)Znetadpsr
r
r�generate_network_configlsrNc
Cstjtjtjj|d�dd�d�}tjtjj|d�dd�}d|ksHd	|krXtjtd
�dS|jdi�jd
�}|jdi�jdg�}d}|jdi�jd�r�|ddd}t	|d	�}||dd|ddgd�dd�|d	D�ddd||dg|d|d�i|t
�d�d�}tjd�tj|�|S)aThis callback will be applied by util.mount_cb() on the mounted
    drive.

    @param mount_dir: String representing path of directory where mounted drive
    is available

    @returns: A dict containing userdata, metadata and cfg based on metadata.
    z
cloud.jsonF)�fname�decode)�textz	user.dataT)rOrZvmrHz(Failed to load metadata. Invalid format.NZadditionalMetadata�usernameZsshKeysZpasswordZsha512Z_idr/)zinstance-idzlocal-hostnamezpublic-keysc	Sshg|]`}|dD]R}|ddtt|dd�d�tt|dd�d�gD]}|d|d��qNqqS)rGrBrErrrA)r-r.)r%r)rrHrG�targetr
r
rr �s

z+read_user_data_callback.<locals>.<listcomp>Zdefault_userzALL=(ALL) NOPASSWD:ALL)r/ZgecosZsudoZpasswdZlock_passwdZssh_authorized_keys)Z
ssh_pwauthZdisable_rootZsystem_info�network_configZmanage_etc_hosts)�userdata�metadatar4�cfgzreturning DATA object:)rZ	load_jsonr	�os�pathr#r=r�getrNrr)Z	mount_dirZ	meta_dataZ	user_datarRZssh_keys�hashrB�datar
r
rr9�sD	


	

r9c@sjeZdZdZejejejej	hiZ
dd�Zdd�Zdd�Z
edd	��Zd
d�Zdd
�Zdd�Zdd�ZdS)�DataSourceRbxCloudZRbxCloudcCstjj||||�d|_dS)N)r�
DataSource�__init__�seed)�selfZsys_cfgr1�pathsr
r
rr_�szDataSourceRbxCloud.__init__cCstjj|�}d||jfS)Nz%s [seed=%s])rr^�__str__r`)ra�rootr
r
rrc�szDataSourceRbxCloud.__str__cCs>t�}|dkrdS|d|_|d|_|d|_|d|_dS)zw
        Metadata is passed to the launching instance which
        is used to perform instance configuration.
        FrUrVr4rWT)r@�userdata_rawrVr4rW)rar>r
r
r�	_get_data�s



zDataSourceRbxCloud._get_datacCs
|jdS)NrT)rW)rar
r
rrT�sz!DataSourceRbxCloud.network_configcCs
|jdS)Nzpublic-keys)rV)rar
r
r�get_public_ssh_keys�sz&DataSourceRbxCloud.get_public_ssh_keyscCs|jS)N)re)rar
r
r�get_userdata_raw�sz#DataSourceRbxCloud.get_userdata_rawcCs|jS)N)rW)rar
r
r�get_config_obj�sz!DataSourceRbxCloud.get_config_objcCst|j|j�dS)N)r4r1)rarWZis_new_instancer
r
r�activateszDataSourceRbxCloud.activateN)�__name__�
__module__�__qualname__ZdsnamerZNETWORKrZBOOT_NEW_INSTANCEZBOOTZBOOT_LEGACYZdefault_update_eventsr_rcrf�propertyrTrgrhrirjr
r
r
rr]�s
r]cCstj|t�S)N)rZlist_from_depends�datasources)Zdependsr
r
r�get_datasource_listsrp)�__doc__r;rXZos.pathZ	cloudinitrZloggingrrrZcloudinit.eventrrZ	getLoggerrkrr
rrr%r'r4r@rNr9r^r]ZDEP_FILESYSTEMrorpr
r
r
r�<module>s&
	
	!F3

Youez - 2016 - github.com/yon3zu
LinuXploit