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 :  /usr/share/netplan/netplan/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


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

Current File : /usr/share/netplan/netplan/__pycache__/terminal.cpython-310.pyc
o

|hEc��@s`dZddlZddlZddlZddlZddlZGdd�de�ZGdd�de�Z	Gdd�de�Z
dS)	z
Terminal / input handling
�Nc@sVeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zddd�Z	ddd�Z
ddd�Zd
S)�Terminalz@
    Do minimal terminal mangling to prompt users for input
    cCs||_d|_d|_|��dS�N)�fd�
orig_flags�	orig_term�save)�selfr�r	�&/usr/share/netplan/netplan/terminal.py�__init__"szTerminal.__init__cCsTtj��r(t�|j�}|dtjB|d<|dtjB|d<t�|jtj	|�dSdS�N��
�sys�stdin�isatty�termios�	tcgetattrr�ICANON�ECHO�	tcsetattr�TCSANOW�r�attrsr	r	r
�enable_echo(s
�zTerminal.enable_echocCsXtj��r*t�|j�}|dtj@|d<|dtj@|d<t�|jtj	|�dSdSrrrr	r	r
�disable_echo/s
�zTerminal.disable_echocCs,t�|jtj�}t�|jtj|tjB�dSr��fcntlr�F_GETFL�F_SETFL�os�
O_NONBLOCK�r�flagsr	r	r
�enable_nonblocking_io6szTerminal.enable_nonblocking_iocCs.t�|jtj�}t�|jtj|tj@�dSrrr"r	r	r
�disable_nonblocking_io:szTerminal.disable_nonblocking_io�xNcCs�td�t�}|�|�|��|��|sd}td�|��|}|dkrbtd�|tt|���dd�t�t	j
gggd�zt	j
��}|d	krO|�|�t
��Wn	tyYYnw|d8}|dks%|�|�t��)
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�dictrrr$�format�len�str�selectrr�read�reset�
InputAccepted�	TypeError�
InputRejected)r�timeout�message�settings�timeout_now�cr	r	r
�get_confirmation_input>s2


���
zTerminal.get_confirmation_inputcCsVt�|jtj�}d}tj��rt�|j�}|dur#|�||d��dS||_	||_
dS)z�
        Save the terminal's current attributes and flags

        Optional argument:
            - dest: if set, save settings to this dict
        N)r#�term)rrrrrrrr�updaterr)r�destrrr	r	r
rps
�
z
Terminal.savecCsdd}d}|dur|�d�}|�d�}n|j}|j}tj��r't�|jtj	|�t
�
|jt
j|�dS)z�
        Reset the terminal to its original attributes and flags

        Optional argument:
            - orig: if set, reset to settings from this dict
        Nr<r#)�getrrrrrrrr�	TCSAFLUSHrr)r�origrrr	r	r
r2�s

zTerminal.reset)r&Nr)�__name__�
__module__�__qualname__�__doc__rrrr$r%r;rr2r	r	r	r
rs

2rc@�eZdZdZdS)r3z Denotes has accepted inputN�rBrCrDrEr	r	r	r
r3��r3c@rF)r5z) Denotes that the user has rejected inputNrGr	r	r	r
r5�rHr5)rErr rr0r�objectr�	Exceptionr3r5r	r	r	r
�<module>sy

Anon7 - 2022
AnonSec Team