__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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[hЏ���SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
 SSKJr SSK
Jr SSKJrJrJrJrJrJr SSKrSSKJrJrJr SSKJrJr \R<"\5r Sr!S	r"S
r#Sr$"SS
\%5r&"SS\&5r'"SS\&5r("SS\&5r)S!S\\*\44Sjjr+Sr,S"Sjr-S"Sjr."SS\R^5r0"SS\05r1"SS\05r2"SS \05r3\2\1\3/r4g)#�N)�suppress)�StringIO)�TimeoutExpired)�Any�Callable�Dict�List�Optional�Tuple)�subp�
temp_utils�util)�get_interface_mac�is_ib_interfacez/run/systemd/netif/leasesz/var/lib/dhclientz.+\.leases?$aN#!/bin/sh
log() {
    echo "udhcpc[$PPID]" "$interface: $2"
}
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
case $1 in
    bound|renew)
    cat <<JSON > "$LEASE_FILE"
{
    "interface": "$interface",
    "fixed-address": "$ip",
    "subnet-mask": "$subnet",
    "routers": "${router%% *}",
    "static_routes" : "${staticroutes}"
}
JSON
    ;;
    deconfig)
    log err "Not supported"
    exit 1
    ;;
    leasefail | nak)
    log err "configuration failed: $1: $message"
    exit 1
    ;;
    *)
    echo "$0: Unknown udhcpc command: $1" >&2
    exit 1
    ;;
esac
c��\rSrSrSrSrg)�NoDHCPLeaseError�Az'Raised when unable to get a DHCP lease.�N��__name__�
__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r��4/usr/lib/python3/dist-packages/cloudinit/net/dhcp.pyrrAs��1rrc��\rSrSrSrSrg)�InvalidDHCPLeaseFileError�Ez�Raised when parsing an empty or invalid dhclient.lease file.

Current uses are DataSourceAzure and DataSourceEc2 during ephemeral
boot to scrape metadata.
rNrrrrrrEs��rrc��\rSrSrSrSrg)�NoDHCPLeaseInterfaceError�Mz7Raised when unable to find a viable interface for DHCP.rNrrrrr"r"Ms��Arr"c��\rSrSrSrSrg)�NoDHCPLeaseMissingDhclientError�Qz$Raised when unable to find dhclient.rNrrrrr%r%Qs��.rr%�returnc��U=(d URnUc[RS5 [5eURRX2U5$)a�Perform dhcp discovery if nic valid and dhclient command exists.

If the nic is invalid or undiscoverable or dhclient command is not found,
skip dhcp_discovery and return an empty dict.

@param nic: Name of the network interface we want to run dhclient on.
@param dhcp_log_func: A callable accepting the dhclient output and error
    streams.
@return: A list of dicts representing dhcp options for each lease obtained
    from the dhclient discovery if run, otherwise an empty list is
    returned.
z1Skip dhcp_discovery: Unable to find fallback nic.)�fallback_interface�LOG�debugr"�dhcp_client�dhcp_discovery)�distro�nic�
dhcp_log_func�	interfaces    r�maybe_perform_dhcp_discoveryr2UsI���0�v�0�0�I����	�	�E�F�'�)�)����,�,�Y�v�N�Nrc�P�[[R"[U5SS95$)z�Parse a systemd lease file content as in /run/systemd/netif/leases/

Parse this (almost) ini style file even though it says:
  # This is private data. Do not parse.

Simply return a dictionary of key/values.F)�list_values)�dict�	configobj�	ConfigObjr)�contents r�networkd_parse_leaser9ls!���	�#�#�H�W�$5�5�I�J�Jrc	��Uc[n0n[RRU5(dU$[R"U5HAn[[R"[RRX555X'MC U$)z�Return a dictionary of dictionaries representing each lease
found in lease_d.i

The top level key will be the filename, which is typically the ifindex.)	�NETWORKD_LEASES_DIR�os�path�isdir�listdirr9r�load_text_file�join)�leases_d�ret�lfiles   r�networkd_load_leasesrEwsm����&���C�
�7�7�=�=��"�"��
����H�%��)���������X� =�>�
��
�&��Jrc��Uc[n[US9n[UR55H!up4UR	U5(dMX@s $ g)N)rB)r;rE�sorted�items�get)�keynamerB�leases�_ifindex�datas     r�networkd_get_option_from_leasesrN�sJ����&��
!�8�
4�F� �����0����8�8�G����=� �1�rc
�B�\rSrSrSrSrSr\S5r\S5r	\S\
4Sj5r\S\
4S	j5r\
RS
\
S\\
\44Sj5r\\
RS
\
S\\\
\
44Sj55r\
RSS
\
S\\S\\
\44Sjj5rSrg)�
DhcpClient���
c��[R"UR5UlUR(d
[	5eg�N)r�which�client_name�dhcp_client_pathr%)�selfs r�__init__�DhcpClient.__init__�s0�� $�
�
�4�+;�+;� <����$�$�1�3�3�%rc�J�[R"SUR/SS/S9 g)N�pkillr���rcs)rrW)�clss r�kill_dhcp_client�DhcpClient.kill_dhcp_client�s���	�	�7�C�O�O�,�1�a�&�9rc��UR5 [R"S5nUHn[R"U5 M g)Nz/var/lib/dhcp/*)rb�globr<�remove)ra�files�files   r�clear_leases�DhcpClient.clear_leases�s2�������	�	�+�,���D��I�I�d�O�r�dhcp_interfacec�@�URSURUSS/S9 g)N�startrr^r_��manage_servicerW�rarkr.s   r�
start_service�DhcpClient.start_service�s&������S�_�_�n�1�a�&�	�	
rc�>�URSURSS/S9 g)N�stoprr^r_rnrps   r�stop_service�DhcpClient.stop_service�s�����f�c�o�o�A�q�6��Brr1r'c��0$)z�Get the most recent lease from the ephemeral phase as a dict.

Return a dict of dhcp options. The dict contains key value
pairs from the most recent lease.
r�rYr1s  r�get_newest_lease�DhcpClient.get_newest_lease�s	���	r�routesc��/$)a8
parse classless static routes from string

The tuple is composed of the network_address (including net length) and
gateway for a parsed static route.

@param routes: string containing classless static routes
@returns: list of tuple(str, str) for all valid parsed routes until the
          first parsing error.
r)r{s r�parse_static_routes�DhcpClient.parse_static_routes�s	���	rNr0c��0$)a�Run dhcp client on the interface without scripts or filesystem
artifacts.

@param interface: Name of the network interface on which to send a
    dhcp request
@param dhcp_log_func: A callable accepting the client output and
    error streams.
@param distro: a distro object for network interface manipulation
@return: dict of lease options representing the most recent dhcp lease
    parsed from the dhclient.lease file
r)rYr1r0r.s    rr-�DhcpClient.dhcp_discovery�s	��$�	r)rX�NN)rrrrrW�timeoutrZ�classmethodrbri�strrqru�abc�abstractmethodrrry�staticmethodr	rr}r
rr-rrrrrPrP�s*���K��G�4�
�:��:������
�3�
��
�
�C�#�C��C�	����#��$�s�C�x�.���������C��D��s�C�x��,A�����	���-1��	��� ��)��

�c�3�h����rrPc	�
^�\rSrSrSrU4Sjr\S\S\\	\\
44Sj5r\S5rS\S\	\\
44S	jr
SS\S
\\S\	\\
44Sjjr\S\S\\\\44S
j5r\S\\4Sj5rS\4SjrSrU=r$)�IscDhclient���dhclientc�0>�[TU]5 SUlg)Nz/run/dhclient.lease��superrZ�
lease_file�rY�	__class__s �rrZ�IscDhclient.__init__�s���
����/��r�
lease_contentr'c��[R"S[R5n/nU(d/$URU5H�n/nUR	S5H]nUR5R
SS5R
SS5nU(dM<URUR	SS55 M_ [U5nURS5nU(a[RU5US'URU5 M� U$)	z�parse the content of a lease file

@param lease_content: a string containing the contents of an
    isc-dhclient lease
@return: a list of leases, most recent last
zlease {(?P<lease>.*?)}\n�;�"rRzoption � r^�unknown-245)�re�compile�DOTALL�findall�split�strip�replace�appendr5rIr��get_ip_from_lease_value)r��lease_regex�dhcp_leases�lease�
lease_options�line�options�opt_245s        r�parse_leases�IscDhclient.parse_leases�s����j�j�!<�b�i�i�H��"$����I� �(�(��7�E��M����C�(���z�z�|�+�+�C��4�<�<�Y��K���4�!�(�(����C��);�<�	)�
�=�)�G��k�k�-�0�G��)4�)L�)L��*��
�&�
���w�'�8��rc	�Z�URSS5n[U5S:�adSnURS5Hn[U5S:XaSU-nX#-
nM [R"S[URSS5S55nOUR
S	5n[R"U5$)
N�\rR��:r^�0z>L�zutf-8)	r��lenr��struct�pack�int�encode�socket�	inet_ntoa)�fallback_lease_value�unescaped_value�
hex_string�hex_pair�packed_bytess     rr��#IscDhclient.get_ip_from_lease_values���.�6�6�t�R�@�����!�#��J�+�1�1�#�6���x�=�A�%�"�X�~�H��&�
�7�"�;�;��c�*�,�,�S�"�5�r�:��L�+�1�1�'�:�L�����-�-rr1c���[[5 [R"UR5nU(a&URU5nU(aUSsSSS5 $SSS5 0$!,(df   0$=f)a�Get the most recent lease from the ephemeral phase as a dict.

Return a dict of dhcp options. The dict contains key value
pairs from the most recent lease.

@param interface: an interface string - not used in this class, but
    required for function signature compatibility with other classes
    that require a distro object
@raises: InvalidDHCPLeaseFileError on empty or unparsable leasefile
    content.
���N)r�FileNotFoundErrorrr@r�r�)rYr1r8r�s    rry�IscDhclient.get_newest_leases`���'�
(��)�)�$�/�/�:�G��"�/�/��8���&�r�?�)�
(�
(��	�
)�
(��	�s�AA(�(
A7r0c	���[RSU5 SnSnSn[URU-5n[URS-5n[	[
5 [R"U5 [R"UR5 SSS5 URRU5 [U5(ahS[U5SS-n	SU<S	U	<S
3n
[R"SS9n[RR!X�S
-5n["R$"XZ5 [&R&"UR)UR*URUUU55up�["R6"X@R/USS9nU(a.[R9SSR!SU555 0$SnSnSnSn[;U5H�n["R<"U5R?5n[U5nURAU5nUS:Xa?[RSU5 [RB"U[DRF5 Sn O0[JRL"U5 M� [RU5 U(d[ROSUUS5 UbU"X�5 URQU5nU(aU$[S5e!,(df   GNR=f![&R,aBn[RSUR.UR0UR25 [4UeSnAff=f![
a	 SUS3nN�[Ha
 SUS3nGNf=f)a�Run dhclient on the interface without scripts/filesystem artifacts.

@param interface: Name of the network interface on which to send a
    dhcp request
@param dhcp_log_func: A callable accepting the dhclient output and
    error streams.
@param distro: a distro object for network interface manipulation
@return: dict of lease options representing the most recent dhcp lease
    parsed from the dhclient.lease file
�!Performing a dhcp discovery on %sz/run/dhclient.pidN�{�G�z�?�z20:%s�$zinterface "z" {send dhcp-client-identifier z;}T��	needs_exez-dhclient.confz3dhclient exited with code: %s stderr: %r stdout: %r)�maxwait�naplenz+dhclient did not produce expected files: %sz, c3�`# �UH$n[RRU5v� M& g7frU)r<r=�basename)�.0�fs  r�	<genexpr>�-IscDhclient.dhcp_discovery.<locals>.<genexpr>}s"���?�w�!�"�'�'�*�*�1�-�-�w�s�,.�unknownFrRr^zkilling dhclient with pid=%s�No PID file found at z, dhclient is still running�PID file contained [z], dhclient is still runningzCdhclient(pid=%s, parentpid=%s) failed to daemonize after %s secondsg$@)*r*r+r�r�rr�r<rfr��net_ops�link_uprrr
�get_tmp_ancestorr=rAr�
write_filer�build_dhclient_cmdrX�ProcessExecutionError�	exit_code�stderr�stdoutr�wait_for_files�warning�ranger@r��
get_proc_ppid�kill�signal�SIGKILL�
ValueError�time�sleep�errorryr)rYr1r0r.�pid_file�config_file�
sleep_time�sleep_cyclesr��dhcp_client_identifier�interface_dhclient_content�tmp_dir�out�errr��missing�ppid�
daemonized�pid_content�	debug_msg�_�pidr�s                       rr-�IscDhclient.dhcp_discovery&s�� 	�	�	�5�y�A�
'�����
��4�<�<�*�4�5���d�l�l�Q�&�'���'�
(��I�I�h���I�I�d�o�o�&�)�	�����y�)�
�9�%�%��+�I�6�r�s�;�;�
#��4�6�
'�
!�1�1�D�A�G��'�'�,�,�w�<L�0L�M�K��O�O�K�D�	.��y�y��)�)��)�)��O�O������H�C�2�%�%�
���'���
����K�K�=��	�	�?�w�?�?�
��I����
����	��|�$�A�
�"�1�1�(�;�A�A�C���+�&���+�+�C�0���1�9��I�I�<�c�B��G�G�C����0�!%�J��	�

�J�J�z�"�+%�.
�I�I�i� ���I�I�����
��$��#�#��%�%�i�0����L�'�)�)�Q)�
(��H�)�)�	.��I�I�E����������	
�#��-��	.��D%�
�+�H�:�60�0���
�*�;�-�80�0��
�s<�7K�/?K0�/M	�
K-�0M�=M�M�	M.�M.�-M.r{c
�^�URS5m[R"ST5Vs/sH
o(dMUPM nn/nST;a%UVs/sHn[[	US55PM nnU4SjnSn[U5GHpupaXe:aM
[	U5nU[
SS5;abS	n[X&S
5U:aU"Xx[X&S
55 Us $SRX&S-US
-5n	SRX&S
-Xh-5n
Xh-nGO�U[
SS5;afSn[X&S
5U:aU"Xx[X&S
55 Us $SRX&S-US-S/-5n	SRX&S-Xh-5n
Xh-nGOVU[
S	S5;afSn[X&S
5U:aU"Xx[X&S
55 Us $SRX&S-US-SS/-5n	SRX&S-Xh-5n
Xh-nO�U[
SS	5;afSn[X&S
5U:aU"Xx[X&S
55 Us $SRX&S-US-/SQ-5n	SRX&S-Xh-5n
Xh-nOjUS:XaJS
n[X&S
5U:aU"Xx[X&S
55 Us $Sn	SRX&S-Xh-5n
Xh-nO[RSU5 Us $URU	<SU<3U
45 GMs U$s snfs snf)aX
parse rfc3442 format and return a list containing tuple of strings.

The tuple is composed of the network_address (including net length) and
gateway for a parsed static route.  It can parse two formats of
rfc3442, one from dhcpcd and one from dhclient (isc).

@param rfc3442: string in rfc3442 format (isc or dhcpd)
@returns: list of tuple(str, str) for all valid parsed routes until the
    first parsing error.

e.g.:

sr=parse_static_routes(        "32,169,254,169,254,130,56,248,255,0,130,56,240,1")
sr=[
    ("169.254.169.254/32", "130.56.248.255"),         ("0.0.0.0/0", "130.56.240.1")
]

sr2 = parse_static_routes(        "24.191.168.128 192.168.128.1,0 192.168.128.1")
sr2 = [
    ("191.168.128.0/24", "192.168.128.1"),        ("0.0.0.0/0", "192.168.128.1")
]

# unknown-121 option format
sr3 = parse_static_routes(        "0:a:0:0:1:20:a8:3f:81:10:a:0:0:1:20:a9:fe:a9:fe:a:0:0:1")
sr3 = [
    ("0.0.0.0/0", "10.0.0.1"),
    ("168.63.129.16/32", "10.0.0.1"),
    ("169.254.169.254/32", "10.0.0.1"),
]

Python version of isc-dhclient's hooks:
   /etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes
r�z[, . :]r�r�c�T>�SU<SU<SU<ST<3n[RU5 g)Nz5RFC3442 string malformed.  Current route has CIDR of z and requires z significant octets, but only z< remain. Verify DHCP rfc3442-classless-static-routes value: )r*r�)�cidr�required�remain�msg�rfc3442s    �r�_trunc_error�5IscDhclient.parse_static_routes.<locals>._trunc_error�s%���
��6�7�4�
�
�I�I�c�Nrr��!�	N�.r^���r�r����r�)r�r�r�z0.0.0.0zSParsed invalid net length "%s".  Verify DHCP rfc3442-classless-static-routes value.�/)�rstripr�r�r�r��	enumerater�r�rAr*r�r�)r{�tok�tokens�
static_routesr�current_idx�idx�
net_length�req_toks�net_address�gatewayr�s           @rr}�IscDhclient.parse_static_routes�s5���T�-�-��$��!#���*�g�!>�F�!>�#�#�#�!>��F�/1�
��'�>�39�:�6�C�c�#�c�2�,�'�6�F�:�	���!�&�)�H�C�� ���S��J��U�2�r�]�*����v�d�|�$�x�/� ��s�6�$�<�7H�I�(�(�!�h�h�v�A�g��a��'@�A���(�(�6��'�C�N�#C�D��!�n���u�R��}�,����v�d�|�$�x�/� ��s�6�$�<�7H�I�(�(�!�h�h�v�A�g��a��'@�C�5�'H�I���(�(�6��'�C�N�#C�D��!�n���u�Q��|�+����v�d�|�$�x�/� ��s�6�$�<�7H�I�(�(�!�h�h�v�A�g��a��'@�C��:�'M�N���(�(�6��'�C�N�#C�D��!�n���u�Q��{�*����v�d�|�$�x�/� ��s�6�$�<�7H�I�(�(�!�h�h���7�S�1�W�-��?����(�(�6��'�C�N�#C�D��!�n���q�����v�d�|�$�x�/� ��s�6�$�<�7H�I�(�(�'���(�(�6��'�C�N�#C�D��!�n���	�	�=���
%�$�� � �'��4�g�>�
�m*�t���WG��
;s�
K9�K9�K>c��SnURUR4[[44H�up#U(dM/n[R
"U5nSnUHin[R"X65(dM [RRX&5n[RRU5nX�:�dMeUnUnMk U(dM�Us $ g![a M�f=f)z�Get the latest lease file from a distro-managed dhclient

Doesn't consider the ephemeral timeframe lease.

@param distro: used for distro-specific lease location and filename
@return: The most recent lease file, or None
Ng�)�dhclient_lease_directory�dhclient_lease_file_regex�DHCLIENT_FALLBACK_LEASE_DIR�DHCLIENT_FALLBACK_LEASE_REGEXr<r?r�r��searchr=rA�getmtime)	r.�latest_file�	directory�regex�lease_files�latest_mtime�fname�abs_path�mtimes	         r�!get_newest_lease_file_from_distro�-IscDhclient.get_newest_lease_file_from_distro%s�����
�/�/��0�0�
�)�*G�H�!
��I����K�
� �j�j��3�� �L�$���y�y��.�.���7�7�<�<�	�9�����(�(��2���'�#(�L�"*�K�%��{�"�"�;!
�<��#%�
��
�s�C�
C�C�keyc���URU5nU(a\[R"U5nU(a>[UR	U55HnURU5nU(dMUs $ ggg)aGet a key from the latest lease from distro-managed dhclient

Doesn't consider the ephemeral timeframe lease.

@param lease_dir: distro-specific lease to check
@param lease_file_regex: distro-specific regex to match lease name
@return: The most recent lease file, or None
N)r(rr@�reversedr�rI)rYr.r*r�r8r��servers       r�get_key_from_latest_lease�%IscDhclient.get_key_from_latest_leaseQsf���;�;�F�C�
���)�)�*�5�G��%�d�&7�&7��&@�A�E�"�Y�Y�s�^�F��v�%�
�B��r�r�r�)rrrrrWrZr�r�r	rrr�r�ryr
rr-rr}r(r.r�
__classcell__�r�s@rr�r��s����K�0���C��D��c�3�h��,@����6�
.��
.��#��$�s�C�x�.��.-1��	E*��E*� ��)�E*�

�c�3�h��E*�N�u�C�u�D��s�C�x��,A�u��u�n�)�X�c�]�)��)�V&�S�&�&rr�c	���\rSrSrSrSrSS\S\\S\	\\
44Sjjr\S	\
S
\S\\
4Sj5r\S\S\S\	4S
j5rS\S\	\\
44Sjr\S\S\\\\44Sj5rSrg)�Dhcpcdid�dhcpcdi,Nr1r0r'c�p�[RSU5 Sn[URU-5n/nURRU5 [
U5(aS/nURSSSSS/UQUPn[R"UURS	9up�UbU"X�5 URU5n
U
(a�[R"/UQSP5RR5nS
nSn
S
n[U5H�n[R"U5R5n[U5nURU5n
U
(a?[RSUU
5 [ R""U
[$R&5  U
$U
s $ [RU5 U
$[3S5e![(a [RSU
5  U
$[*a	 SUS3nO[,a	 SUS3nOf=f[.R0"U5 GM![4aBn[RSURUR6UR5 [2UeS
nAf[R8aBn[RSUR:UR6UR5 [2UeS
nAff=f)a�Run dhcpcd on the interface without scripts/filesystem artifacts.

@param interface: Name of the network interface on which to send a
    dhcp request
@param dhcp_log_func: A callable accepting the client output and
    error streams.
@param distro: a distro object for network interface manipulation
@return: dict of lease options representing the most recent dhcp lease
    parsed from the dhclient.lease file
r�r�z
--clientid�
--ipv4onlyz--waitipz--persistentz--noarpz--script=/bin/true)r�Nz-PFrRz!killing dhcpcd with pid=%s gid=%sz9Process group id [%s] has already exited, nothing to killr�z, dhcpcd is still runningr�z], dhcpcd is still runningzNo lease foundz8dhcpcd timed out after %s seconds: stderr: %r stdout: %r�1dhcpcd exited with code: %s stderr: %r stdout: %r)r*r+r�r�r�r�rrWrryr�r�r�rr@�
get_proc_pgidr<�killpgr�r��ProcessLookupErrorr�r�r�r�rrr�r�r�)rYr1r0r.r�r��infiniband_argument�commandr�r�r�r�r��gidr�r�r�r�s                  rr-�Dhcpcd.dhcp_discoveryhs��� 	�	�	�5�y�A��
��4�<�<�*�4�5�� ��	�����y�)�[	.��y�)�)�'3�n�#�� � �����$�
	�%�	��	�G��y�y������H�C��(��c�'��)�)�)�4�E�� �9�9�%5�w�%5��%5�6�=�=�C�C�E��"�����	��|�,�A�%�&*�&9�&9�(�&C�&I�&I�&K��!�+�.��$�2�2�3�7����I�I� C�S�#���I�I�c�6�>�>�:�!�.��9�0 %��;-�@�I�I�i�(���"�#3�4�4��/.���	�	�.���
� ��-��3�H�:�>6�6�"�&��2�;�-�@6�6�"����J�J�z�*���	.��I�I�J��
�
�������	
�#��-���)�)�	.��I�I�C����������	
�#��-��	.�st�B3H�BF2�H�
H�H�'H�2 G9�H�G9�%H�'G9�6H�8G9�9H�
J5�=I�J5�3=J0�0J5rM�dhcp_option_numberc�^�SnS[S[4SjnU"X5HupEXA:XdMUs $ g)a&get a specific option from a binary lease file

This is required until upstream dhcpcd supports unknown option 245
upstream bug: https://github.com/NetworkConfiguration/dhcpcd/issues/282

@param data: Binary lease data
@param number: Option number to return
@return: the option (bytes) or None
��rM�indexc3�# �[U5US-:�a<XnUSU-nUSU-SU-U-nX$4v� SU-U-n[U5US-:�aM;gg7f)z�options are variable length, and consist of the following format

option number: 1 byte
option length: 1 byte
option data: variable length (see length field)
r�r^N)r�)rMrC�code�length�options     r�iter_options�>Dhcpcd.parse_unknown_options_from_packet.<locals>.iter_options�sl����d�)�u�q�y�(��{���a�%�i����a�%�i�!�e�)�f�*<�=���l�"��F�
�U�*���d�)�u�q�y�(�s�AA�AN)�bytesr�)rMr@�INDEXrHrErGs      r�!parse_unknown_options_from_packet�(Dhcpcd.parse_unknown_options_from_packet�s?��.��	+�u�	+�S�	+�)��5�L�D��)��
�6�r�
lease_dumpc
�@�[RSX5 [UR5R	SS5RS5Vs/sHnSU;dMURSSS9PM sn5nU(d$Sn[R
X@5 [X@-5eXS'UR5VVs0sHupgUR	SS
5U_M nnnSSS.nUR5Hup�X�;dMURU	5X:'M! [R"SUS35n[RUS5nU(a[R "U5US'U$s snf![a"n[R
S	U5 [UeS
nAff=fs snnf)a�parse the output of dhcpcd --dump

map names to the datastructure we create from dhclient

example dhcpcd output:

broadcast_address='192.168.15.255'
dhcp_lease_time='3600'
dhcp_message_type='5'
dhcp_server_identifier='192.168.0.1'
domain_name='us-east-2.compute.internal'
domain_name_servers='192.168.0.2'
host_name='ip-192-168-0-212'
interface_mtu='9001'
ip_address='192.168.0.212'
network_number='192.168.0.0'
routers='192.168.0.1'
subnet_cidr='20'
subnet_mask='255.255.240.0'
z)Parsing dhcpcd lease for interface %s: %r�'rR�
�=r^)�maxsplitz;No valid DHCP lease configuration found in dhcpcd lease: %rzError parsing dhcpcd lease: %rNr1r��-z
fixed-addressr)z
ip-addresszclassless-static-routesz/var/lib/dhcpcd/z.lease�r�)r*r+r5r�r�r�r�rr�rH�popr�load_binary_filer4rLr�r�)
rNr1�ar�r�r�r*�value�name_map�source�destination�dhcp_messager�s
             r�parse_dhcpcd_lease�Dhcpcd.parse_dhcpcd_leases���,	�	�	�7��	
�
	7��(�-�-�/�7�7��R�@�F�F�t�L��L���a�x�-�A�G�G�C�!�G�,�L���E��0���	�	�#�*�/��0@�A�A�
�'�k��AF���
�N�
�*�#����S�#�&��-�
��N�*�'6�
��$,�>�>�#3��F���%*�Y�Y�v�%6��"�$4��,�,��y�k��0�
���:�:�<��M���#)�#3�#3�G�#<�E�-� ����U���	7��I�I�6�
�C�+��6��	7��Os5�6E+�
E&�E&�02E+�:F�&E+�+
F�5F�Fc�2�UR[R"URSSU/5RU5$![RaBn[
R
SURURUR5 [UeSnAff=f)z�Return a dict of dhcp options.

@param interface: which interface to dump the lease from
@raises: InvalidDHCPLeaseFileError on empty or unparsable leasefile
    content.
z--dumpleaser7r8N)
r^rrWr�r�r*r+r�r�r)rYr1r�s   rry�Dhcpcd.get_newest_leaseTs���	.��*�*��	�	��(�(�%�$�!�	���&��
�

���)�)�	.��I�I�C����������	
�#��-��	.�s�=A�B�=B�Br{c��UR5nU(a([USSS2USSS25Vs/sHo"PM sn$[RSU5 /$s snf)a
classless static routes as returned from dhcpcd --dumplease and return
a list containing tuple of strings.

The tuple is composed of the network_address (including net length) and
gateway for a parsed static route.

@param routes: string containing classless static routes
@returns: list of tuple(str, str) for all valid parsed routes until the
          first parsing error.

e.g.:

sr=parse_static_routes(
    "0.0.0.0/0 10.0.0.1 168.63.129.16/32 10.0.0.1"
)
sr=[
    ("0.0.0.0/0", "10.0.0.1"),
    ("169.63.129.16/32", "10.0.0.1"),
]
Nr�r^z'Malformed classless static routes: [%s])r��zipr*r��r{r�is   rr}�Dhcpcd.parse_static_routesqs^��.����
��"�=��1��#5�}�Q�T��T�7J�K�L�K�!�A�K�L�L����=�v�F��	��Ms�Arr�)rrrrrWr�r�r
rrrr-r�rJr�rLr^ryr	rr}rrrrr4r4ds����K��G�
-1��	u.��u.� ��)�u.�

�c�3�h��u.�n�)��)�),�)�	�%��)��)�V�F�s�F�s�F�t�F��F�P.�#�.�$�s�C�x�.�.�:��C��D��s�C�x��,A���rr4c	�^�\rSrSrSrU4SjrSS\S\\S\	\\
44SjjrS\S\	\\
44Sjr\
S	\S\\\\44S
j5rSrU=r$)
�Udhcpci��udhcpcc�0>�[TU]5 SUlg)NrRr�r�s �rrZ�Udhcpc.__init__�s���
������rr1r0r'c���[RSU5 [R"SS9n[R
R
XAS-5Ul[[5 [R"UR5 SSS5 URRU5 [R
R
US5n[R"U[S5 UR SS	S
USUSS
SS/n[#U5(a>UR%SSR'[)U5SSR+SS55/5 [,R,"USUR0SS9upxUbU"Xx5 UR9U5$!,(df   GN=f![,R.aBn	[RSU	R0U	R2U	R45 [6U	eSn	A	ff=f)aBRun udhcpc on the interface without scripts or filesystem artifacts.

@param interface: Name of the network interface on which to run udhcpc.
@param dhcp_log_func: A callable accepting the udhcpc output and
    error streams.
@return: A list of dicts of representing the dhcp leases parsed from
    the udhcpc lease file.
r�Tr�z.lease.jsonN�
udhcpc_scripti�z-O�staticroutesz-iz-sz-nz-qz-fz-vz-xz	0x3d:20{}r�r�rR�
LEASE_FILE)�
update_env�capturez1udhcpc exited with code: %s stderr: %r stdout: %r)r*r+r
r�r<r=rAr�rr�rfr�r�rr��
UDHCPC_SCRIPTrWr�extend�formatrr�rr�r�r�r�rry)
rYr1r0r.r�rm�cmdr�r�r�s
          rr-�Udhcpc.dhcp_discovery�s���	�	�	�5�y�A��-�-��=���'�'�,�,�w�M�0I�J���
�'�
(��I�I�d�o�o�&�)�	�����y�)������W�o�>�
����
�}�e�<�
�������������
��$�9�%�%��J�J���&�&�)�)�4�R�S�9�A�A�#�r�J���
�	.��y�y���t��� ?���H�C��$��#�#��$�$�Y�/�/�i)�
(��P�)�)�	.��I�I�C����������	
�#��-��	.�s$�!!F�$F�
F�G/�-=G*�*G/c�j�[R"[R"UR55$)a�Get the most recent lease from the ephemeral phase as a dict.

Return a dict of dhcp options. The dict contains key value
pairs from the most recent lease.

@param interface: an interface name - not used in this class, but
    required for function signature compatibility with other classes
    that require a distro object
@raises: InvalidDHCPLeaseFileError on empty or unparsable leasefile
    content.
)r�	load_jsonr@r�rxs  rry�Udhcpc.get_newest_lease�s"���~�~�d�1�1�$�/�/�B�C�Crr{c��UR5nU(a([USSS2USSS25Vs/sHo"PM sn$/$s snf)Nr�r^)r�rcrds   rr}�Udhcpc.parse_static_routes�sM������
��"�=��1��#5�}�Q�T��T�7J�K�L�K�!�A�K�L�L��	��Ms�Ar0r�)rrrrrWrZr�r
rrrr-ryr�r	rr}rr1r2s@rrhrh�s�����K��-1��	F0��F0� ��)�F0�

�c�3�h��F0�PD�#�D�$�s�C�x�.�D���C��D��s�C�x��,A���rrhr�rU)5r�re�loggingr<r�r�r�r�r��
contextlibr�ior�
subprocessr�typingrrrr	r
rr6�	cloudinitrr
r�
cloudinit.netrr�	getLoggerrr*r;rrrr�	Exceptionrrr"r%r�r2r9rErN�ABCrPr�r4rh�ALL_DHCP_CLIENTSrrr�<module>r�s�����	�	�
�
�
����%�=�=��,�,�<�
����!��1��1�� /���
�B2�y�2�� 0��B� 0�B�/�&6�/�
%)�O�	�#�s�(�^�O�.K��&�H����H�VB&�*�B&�Ji�Z�i�X	c�Z�c�L�K��0�r

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