403Webshell
Server IP : 15.235.198.142  /  Your IP : 216.73.216.35
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/netplan/netplan_cli/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/netplan/netplan_cli/__pycache__/terminal.cpython-312.pyc
�

*C�e���r�dZddlZddlZddlZddlZddlZGd�de�ZGd�de�Z	Gd�de�Z
y)	z
Terminal / input handling
�Nc�F�eZdZdZd�Zd�Zd�Zd�Zd�Zdd�Z	dd	�Z
dd
�Zy)
�Terminalz@
    Do minimal terminal mangling to prompt users for input
    c�N�||_d|_d|_|j�y�N)�fd�
orig_flags�	orig_term�save)�selfrs  �*/usr/share/netplan/netplan_cli/terminal.py�__init__zTerminal.__init__"s ������������	�	��c�B�tjj�r�tj|j
�}|dtjz|d<|dtjz|d<tj|j
tj|�yy�N��
�sys�stdin�isatty�termios�	tcgetattrr�ICANON�ECHO�	tcsetattr�TCSANOW�r�attrss  r�enable_echozTerminal.enable_echo(sq���9�9�����%�%�d�g�g�.�E��Q�x�'�.�.�0�E�!�H��Q�x�'�,�,�.�E�!�H����d�g�g�w����>�	rc�F�tjj�r�tj|j
�}|dtjz|d<|dtjz|d<tj|j
tj|�yyrrrs  r�disable_echozTerminal.disable_echo/su���9�9�����%�%�d�g�g�.�E��Q�x�7�>�>�/�1�E�!�H��Q�x�7�<�<�-�/�E�!�H����d�g�g�w����>�	rc���tj|jtj�}tj|jtj|tj
z�yr��fcntlr�F_GETFL�F_SETFL�os�
O_NONBLOCK�r�flagss  r�enable_nonblocking_iozTerminal.enable_nonblocking_io6s;�����D�G�G�U�]�]�3��
���D�G�G�U�]�]�E�B�M�M�,A�Brc���tj|jtj�}tj|jtj|tj
z�yrr"r(s  r�disable_nonblocking_iozTerminal.disable_nonblocking_io:s=�����D�G�G�U�]�]�3��
���D�G�G�U�]�]�E�R�]�]�N�,B�CrNc
�n�td�t�}|j|�|j�|j	�|sd}tdj|��|}|dkDr�tdj|t
t|���d��tjtjgggd�	tjj�}|d	k(r|j|�t��	|dz}|dkDr��|j|�t��#t$rY�1wxYw)
a�
        Get a "confirmation" input from the user, for at most (timeout)
        seconds. Optionally, customize the message to be displayed.

        timeout -- timeout to wait for input (default 120)
        message -- optional customized message ("Press ENTER to (message)")

        raises:
        InputAccepted -- the user confirmed the changes
        InputRejected -- the user rejected the changes
        z%Do you want to keep these settings?

zaccept the new configurationz&Press ENTER before the timeout to {}

rz%Changes will revert in {:>{}} seconds�
)�end��
)�print�dictr
r r*�format�len�str�selectrr�read�reset�
InputAccepted�	TypeError�
InputRejected)r�timeout�message�settings�timeout_now�cs      r�get_confirmation_inputzTerminal.get_confirmation_input>s��	�7�8��6���	�	�(�������"�"�$��4�G�
�8�?�?��H�I����Q���9�@�@��c�RU�V]�R^�N_�`�fj�k�
�M�M�3�9�9�+�r�2�q�1�
��I�I�N�N�$����I��J�J�x�(�'�/�)��
�1��K�%�Q��.	
�
�
�8���o����
��	
�s�>D(�(	D4�3D4c�(�tj|jtj�}d}tjj�rt
j|j�}|�|j||d��y||_	||_
y)z�
        Save the terminal's current attributes and flags

        Optional argument:
            - dest: if set, save settings to this dict
        N)r)�term)r#rr$rrrrr�updaterr	)r�destrr	s    rr
z
Terminal.savepsq���[�[����%�-�-�8�
��	��9�9�����)�)�$�'�'�2�I����K�K�*�!*�,�
-�)�D�O�&�D�Nrc�~�d}d}|�#|jd�}|jd�}n|j}|j}tjj�r/t
j|jtj|�tj|jtj|�y)z�
        Reset the terminal to its original attributes and flags

        Optional argument:
            - orig: if set, reset to settings from this dict
        NrDr))�getr	rrrrrrr�	TCSAFLUSHr#r%)r�origr	rs    rr9zTerminal.reset�s����	��
�������(�I����'�*�J����I����J��9�9�������d�g�g�w�'8�'8�)�D�
���D�G�G�U�]�]�J�7r)�xNr)�__name__�
__module__�__qualname__�__doc__r
rr r*r,rBr
r9�rrrrs2����?�?�C�D�0�d'�$8rrc��eZdZdZy)r:z Denotes has accepted inputN�rLrMrNrOrPrrr:r:�s��%�rr:c��eZdZdZy)r<z) Denotes that the user has rejected inputNrRrPrrr<r<�s��3�rr<)rOr#r&rr7r�objectr�	Exceptionr:r<rPrr�<module>rVsB��$�
�	��
�
�v8�v�v8�r	�I�	�
	�I�	r

Youez - 2016 - github.com/yon3zu
LinuXploit