403Webshell
Server IP : 43.141.50.122  /  Your IP : 113.219.202.173
Web Server : Apache
System : Linux VM-8-5-opencloudos 6.6.34-9.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 19 19:35:45 CST 2024 x86_64
User : www ( 1000)
PHP Version : 8.1.27
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/cloudinit/sources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/cloudinit/sources/__pycache__/DataSourceScaleway.cpython-311.pyc
�

hg�d�=���ddlZddlZddlZddlZddlmZddlZddlmZddl	m
Z
ddlmZddl
mZddl
mZddl
mZmZmZmZdd	lmZmZdd
lmZddlmZmZddlmZdd
lm Z ej!e"��Z#ddgZ$dZ%dZ&dZ'Gd�dej(j)��Z*d�Z+d�Z,Gd�dej-��Z.e.ej/ffgZ0d�Z1dS)�N)�urlparse)�ConnectionError)�HTTPConnection)�PoolManager)�dmi)�log)�net�sources�
url_helper�util)�
EventScope�	EventType)�NoDHCPLeaseError)�EphemeralDHCPv4�EphemeralIPv6Network)�DataSourceHostname)�ProcessExecutionErrorzhttp://169.254.42.42zhttp://[fd00:42::42]���
c�*��eZdZdZ�fd�Zdd�Z�xZS)�SourceAddressAdapterzF
    Adapter for requests to choose the local address to bind to.
    c�V��||_tt|��jdi|��dS)N�)�source_address�superr�__init__)�selfr�kwargs�	__class__s   ��I/usr/lib/python3.11/site-packages/cloudinit/sources/DataSourceScaleway.pyrzSourceAddressAdapter.__init__,s5���,���2��"�D�)�)�2�<�<�V�<�<�<�<�<�Fc��tjtjtjdfgz}t||||j|���|_dS)N�)�	num_pools�maxsize�blockr�socket_options)r�default_socket_options�socket�
SOL_SOCKET�SO_REUSEPORTrr�poolmanager)r�connectionsr&r'r(s     r!�init_poolmanagerz%SourceAddressAdapter.init_poolmanager0sV��'�>�
�
�� 3�Q�7�B
�
��'�!����.�)�
�
�
����r")F)�__name__�
__module__�__qualname__�__doc__rr/�
__classcell__�r s@r!rr'sV���������=�=�=�=�=�

�

�

�

�

�

�

�

r"rc��	tj|d|d|d����}tj|j��S#tj$r}|jdkrYd}~dS�d}~wwxYw)aQ
    Retrieve user data or vendor data.

    Scaleway user/vendor data API returns HTTP/404 if user/vendor data is not
    set.

    This function calls `url_helper.readurl` but instead of considering
    HTTP/404 as an error that requires a retry, it considers it as empty
    user/vendor data.

    Also, be aware the user data/vendor API requires the source port to be
    below 1024 to ensure the client is root (since non-root users can't bind
    ports below 1024). If requests raises ConnectionError (EADDRINUSE), the
    caller should retry to call this function on an other port.
    Nrc�b�|jdko$t|jtjj��S)N�)�code�
isinstance�cause�requests�
exceptionsr)�_�excs  r!�<lambda>z%query_data_api_once.<locals>.<lambda>Xs,����C��)��s�y�(�*=�*M�N�N�N�r")�data�timeout�retries�session�exception_cbr8)r�readurlr�
decode_binary�contents�UrlErrorr9)�api_addressrB�requests_session�respr?s     r!�query_data_api_oncerM=s��� ��!�����$���
�
�
���!�$�-�0�0�0��������8�s�?�?��4�4�4�4�4�
�����	���s�36�A�A�A�Ac���tdt|d����D�]V}	t�d||��t	j��}d}	t
|��j}|}|ddkr
|dd�}tj	|dtj
�	��dd}	|	tjkrd
}n#t$rYnwxYw|�
dt||f�����t|||�
��}
t�d|��|
cS#t j$r=}t�d||��t'jd��|}Yd}~��Pd}~wwxYw|�)a/Get user or vendor data.

    Handle the retrying logic in case the source port is used.

    Scaleway metadata service requires the source port of the client to
    be a privileged port (<1024).  This is done to ensure that only a
    privileged user on the system can access the metadata service.
    r$rz*Trying to get %s data (bind on port %d)...z0.0.0.0r�[���N��protoz0::zhttp://)r)rBrKz%s-data downloadedz%Error while trying to get %s data: %s�)�range�max�LOG�debugr<�Sessionr�netlocr*�getaddrinfo�IPPROTO_TCP�AF_INET6�
ValueError�mountrrMrrI�warning�time�sleep)
�api_typerJrCrB�portrK�	localhost�url_address�address�
addr_protorAr?�last_excs
             r!�query_data_apiries����a��W�a���)�)�#�#��"	��I�I�<�h��
�
�
� (�/�1�1��!�I�
�&�{�3�3�:��%���q�>�S�(�(�)�!�B�$�/�G�#�/��T��);��������
����0�0� %�I����
�
�
���
�����"�"��$�Y��4E�F�F�F�
�
�
�'��W�?O����D�
�I�I�*�H�5�5�5��K�K�K���"�	�	�	��K�K�?��3�O�O�O��J�q�M�M�M��H��H�H�H�H�����	�����Ns=�1D(�A+C�D(�
C�D(�
C�AD(�(E4�72E/�/E4c����eZdZdZejejejej	hiZ
�fd�Zd�Zd�Z
ed���Zd�Zd�Zed���Zed	���Zd
�Zd�Zdd
�Zed���Zed���Z�xZS)�DataSourceScaleway�Scalewayc����tt|���|||��tjtj|ddgi��g��|_t|j�dt����|_
t|j�dt����|_t|j�dt����|_d|_t j|_t&|_d|_d|_d|_d|_d|j���vr|xj|jdz
c_dSdS)N�
datasourcerlrCrB�max_waitT�
metadata_urls)rrkrr�
mergemanydict�get_cfg_by_path�ds_cfg�int�get�DEF_MD_RETRIESrC�DEF_MD_TIMEOUTrB�DEF_MD_MAX_WAITro�_fallback_interfacer
�UNSET�_network_config�DS_BASE_URLSrp�userdata_url�vendordata_url�ephemeral_fixed_address�has_ipv4�keys)r�sys_cfg�distro�pathsr s    �r!rzDataSourceScaleway.__init__�s0���
� �$�'�'�0�0��&�%�H�H�H��(��$�W�|�Z�.H�"�M�M�
�
�
����4�;�?�?�9�n�E�E�F�F����4�;�?�?�9�n�E�E�F�F����D�K�O�O�J��H�H�I�I��
�#'�� �&�}���)��� ���"���'+��$���
��d�k�.�.�0�0�0�0����$�+�o�">�>�����1�0r"c�t�tj��}tj||j|jd���\}}|r;t
�d|��|�d�|_|�d�|_|�d�|_	dSt
�d|ttj��|z
����t�)	zO
        Define metadata_url based upon api-metadata URL availability.
        F)�urlsrorB�connect_synchronouslyz%s is reachablez/conf?format=jsonz/user_data/cloud-initz/vendor_data/cloud-initNz3Unable to reach api-metadata at %s after %s seconds)r`r�wait_for_urlrorBrVrW�metadata_urlr}r~rtr)rr��
start_time�	avail_urlr>s     r!�_set_metadata_urlz$DataSourceScaleway._set_metadata_url�s���
�Y�[�[�
�!�.���]��L�"'�	
�
�
��	�1��	"��I�I�'��3�3�3�#,� ?� ?� ?�D��#,� C� C� C�D��%.�"G�"G�"G�D���F��I�I�E���D�I�K�K�*�,�-�-�
�
�
�
"�!r"c�J�tj|j|j|j���}tjtj|j	����|_
td|j|j|j��|_
td|j|j|j��|_dS)N)rBrCz	user-datazvendor-data)rrFr�rBrC�json�loadsrrGrH�metadatarir}�userdata_rawr~�vendordata_raw)rrLs  r!�_crawl_metadataz"DataSourceScaleway._crawl_metadata�s����!���t�|�T�\�
�
�
���
�4�#5�d�m�#D�#D�E�E��
�*���*�D�L�$�,�
�
���-��4�.���d�l�
�
����r"c��tjd��}|dkrdStj�d��rdStj��}d|vrdSdS)a 
        There are three ways to detect if you are on Scaleway:

        * check DMI data: not yet implemented by Scaleway, but the check is
          made to be future-proof.
        * the initrd created the file /var/run/scaleway.
        * "scaleway" is in the kernel cmdline.
        zsystem-manufacturerrlTz/var/run/scaleway�scalewayN)r�
read_dmi_data�os�path�existsr�get_cmdline)�vendor_name�cmdlines  r!�	ds_detectzDataSourceScaleway.ds_detect�sg���'�(=�>�>���*�$�$��4�
�7�>�>�-�.�.�	��4��"�$�$���� � ��4�!� r"c�x�|dvrt�d|��gSg}|D]�}t|��j}|ddkr
|dd�}t	j|dtj���dd}|tjkr
|dkr||gz
}�v|tjkr
|d	kr||gz
}����|S)
N)�ipv4�ipv6zInvalid IP version : %srrOr$rPrQr�r�)	rVrWrrYr*rZr[�AF_INETr\)rrRr��
filtered_urls�urlrfrgs       r!�_set_urls_on_ip_versionz*DataSourceScaleway._set_urls_on_ip_version�s����(�(�(��I�I�/��7�7�7��I��
��
	�
	�C��s�m�m�*�G��q�z�S� � �!�!�B�$�-���+���V�%7��������J��V�^�+�+������#��&�
���v��.�.�5�F�?�?��#��&�
����r"c�x�|j�tj��|_|jr�	t	|j|j��5}t
jtj	d|j
|jf���t
jtj	d|j���|d|_
d|jd<ddd��n#1swxYwYnR#tt t"f$r8}t
jtt'|����d|_Yd}~nd}~wwxYw|js�	t)|j��5t
jtj	d	|j
|jf���t
jtj	d|j���d
|jd<ddd��n#1swxYwYn#t $rYdSwxYwdS)Nz3Set api-metadata URL depending on IPv4 availability)�logfunc�msg�func�argszCrawl of metadata service)r�r�r�z
fixed-addressr��
net_in_useFz3Set api-metadata URL depending on IPv6 availabilityr�T)ryr	�find_fallback_nicr�rr�r�log_timerVrWr�rpr�rr�rrr�logexc�strr)rr��es   r!�	_get_datazDataSourceScaleway._get_data
s����#�+�'*�'<�'>�'>�D�$�
�=�	&�
&�%��K��,���9���M� #�	�,�!�3�"�0�2������M� #�	�7�!�1�����
48��3H�D�0�28�D�M�,�/�#9�9�9�9�9�9�9�9�9�9�9����9�9�9�9���&!��%��
&�
&�
&�
��C��Q���(�(�(�!&��
�
�
�
�
�
�����
&�����}�	�
�)��,���9�9��M� #�	�,�!�3�"�0�2������M� #�	�7�!�1�����
39�D�M�,�/�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9��� $�
�
�
��u�u�
�����tss�C�A+B9�-C�9B=�=C�B=�C�D�.D�D�F)�3AF�F)�F!�!F)�$F!�%F)�)
F7�6F7c	��|j�6t�dtj��tj|_|jtjkr|jS|j�t
j��|_|jd��i}i}|jdD]�}|d|j	krd|d<dd	d
�g|d<�"d|�
��vr#|dxx|d�d
|d��fz
cc<n|d�d
|d��f|d<|ddkr9|ddd�}d|�
��vr|dxx|gz
cc<��|g|d<��|||j<d|d�|_n{dd|jzd�}ddig}|jdrL|dd|jddzd|jddzddd|jddzd�gd�gz
}||d <d!|gd"�|_t�d#|j��|jS)$z`
        Configure networking according to data received from the
        metadata API.
        Nz5Found None as cached _network_config. Resetting to %s�
private_ip�
public_ipsrfT�dhcp4z169.254.42.42/32z
62.210.0.1)�to�via�routes�	addresses�/�netmask�family�inet6�gatewayz::/0)r�r�r)�version�	ethernets�physicalz%s)�type�namer�r��staticz::�0)�network�prefixr�)r�rfr�r��subnetsr$)r��configznetwork_config : %s)r{rVr_r
rzryr	r�r�rr�rW)r�netcfg�ip_cfg�ip�router�s      r!�network_configz!DataSourceScaleway.network_configMs�����'��K�K�G��
�
�
�
�$+�=�D� ���7�=�0�0��'�'��#�+�'*�'<�'>�'>�D�$��=��&�.��F��F��m�L�1�
7�
7���i�=�D�$@�@�@�&*�F�7�O� 2�,�G�G�(�F�8�$�$�#�f�k�k�m�m�3�3��{�+�+�+�!�)�}�>�>�r�)�}�>�>�0��+�+�+�+�
 "�)�}�>�>�r�)�}�>�>�/��{�+��(�|�w�.�.�(*�9�
�V� D� D��#�v�{�{�}�}�4�4�"�8�,�,�,���7�,�,�,�,�05�w�F�8�,��/5�F�4�+�,�/0�v�#F�#F�D� � �#��t�7�7���F���(�)�G��}�V�$�
�� (�#'�$�-��*?�	�*J�#J�#'�$�-��*?�	�*J�#J�,0�*-�+/�"&�-��"7�	�"B�,C���#�	�����!(�F�9��/0�V�H�#E�#E�D� ��	�	�'��)=�>�>�>��#�#r"c��dS�Nr�rs r!�launch_indexzDataSourceScaleway.launch_index�����tr"c��|jdS)N�id)r�r�s r!�get_instance_idz"DataSourceScaleway.get_instance_id�s���}�T�"�"r"c� �d�|jdD��}d}t|��}|j�dg��D]I}|�|��s�|�||d��dd�����J|S)Nc��g|]
}|d��S)�keyr)�.0r�s  r!�
<listcomp>z:DataSourceScaleway.get_public_ssh_keys.<locals>.<listcomp>�s��K�K�K�3�C��J�K�K�Kr"�ssh_public_keyszAUTHORIZED_KEY=�tagsr>� )r��lenru�
startswith�append�replace)r�ssh_keys�akeypre�plen�tags     r!�get_public_ssh_keysz&DataSourceScaleway.get_public_ssh_keys�s���K�K�$�-�8I�*J�K�K�K��#���7�|�|���=�$�$�V�R�0�0�	:�	:�C��>�>�'�*�*�
���O�O�C����J�.�.�s�C�8�8�9�9�9�9��r"Fc�8�t|jdd��S)N�hostnameF)rr�)r�fqdn�
resolve_ip�
metadata_onlys    r!�get_hostnamezDataSourceScaleway.get_hostname�s��!�$�-�
�";�U�C�C�Cr"c��dSr�rr�s r!�availability_zonez$DataSourceScaleway.availability_zone�r�r"c��dSr�rr�s r!�regionzDataSourceScaleway.region�r�r")FFF)r0r1r2�dsnamer
�NETWORKr�BOOT_NEW_INSTANCE�BOOT�BOOT_LEGACY�default_update_eventsrr�r��staticmethodr�r�r��propertyr�r�r�r�r�r�r�r4r5s@r!rkrk�s_�������
�F����'��N��!�
���?�?�?�?�?�,"�"�"�4
�
�
�����\��(���0>�>�>�@�J$�J$��X�J$�X����X��#�#�#�
�
�
�D�D�D�D�����X������X�����r"rkc�6�tj|t��Sr�)r
�list_from_depends�datasources)�dependss r!�get_datasource_listr��s���$�W�k�:�:�:r")2r�r�r*r`�urllib.parserr<�requests.exceptionsr�urllib3.connectionr�urllib3.poolmanagerr�	cloudinitrr�loggingr	r
rr�cloudinit.eventr
r�cloudinit.net.dhcpr�cloudinit.net.ephemeralrr�cloudinit.sourcesr�cloudinit.subpr�	getLoggerr0rVr|rvrxrw�adapters�HTTPAdapterrrMri�
DataSourcerk�DEP_FILESYSTEMr�r�rr"r!�<module>rs������	�	�	�	�
�
�
�
�����!�!�!�!�!�!�����/�/�/�/�/�/�.�-�-�-�-�-�+�+�+�+�+�+�������$�$�$�$�$�$�4�4�4�4�4�4�4�4�4�4�4�4�1�1�1�1�1�1�1�1�/�/�/�/�/�/�I�I�I�I�I�I�I�I�0�0�0�0�0�0�0�0�0�0�0�0��g���!�!��&�(>�?��������
�
�
�
�
�8�,�8�
�
�
�,%�%�%�P1�1�1�h]�]�]�]�]��+�]�]�]�B	�'�0�2�3���
;�;�;�;�;r"

Youez - 2016 - github.com/yon3zu
LinuXploit