403Webshell
Server IP : 209.205.66.10  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User :  ( 1006)
PHP Version : 8.5.8
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/aptdaemon/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/aptdaemon/__pycache__/console.cpython-310.pyc
o

��U�w�@s4dZdZdZddlZddlZddlmZddlmZddlZddl	m
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlmZdd	lmZddlZejjjd
d�ddlZdd
lmZddlmZddlm Z e!d�dZ"e!d�dZ#ej$j%dkZ&Gdd�d�Z'dd�Z(e)dkr�e(�dSdS)z>
This module provides a command line client for the aptdaemon
z%Sebastian Heinlein <devel@glatzor.de>)�
ConsoleClient�main�N)�gettext)�ngettext)�OptionParser)�SourceEntry)�GLibT)�set_as_default�)�client)�enums)�errors�z[1mz[0m�c@s2eZdZdZ		dLdd�ZdMdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�ZdNd4d5�Zd6d7�Zd8d9�Zd:d;�Zd<d=�Zd>d?�Z d@dA�Z!dBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&d3S)Orz4
    Command line interface client to aptdaemon
    TFcCs�t��|_t��\|_|_g|_t�tj	|j
�t�tj|j
�t�tj|j
�|��|_g|_d|_d|_d|_d|_||_||_||_d|_d|_d|_d|_d|_t��|_d|_t �!�|_"dS)NT�rz|/-\���)#r�	AptClient�_client�pty�openpty�	master_fd�slave_fd�_signals�signal�SIGINT�_on_cancel_signal�SIGQUIT�SIGWINCH�_on_terminal_resize�_get_terminal_width�_terminal_width�	_watchers�
_old_tty_mode�_show_status�_status�_percent�_show_terminal�_details�_allow_unauthenticated�_show_progress�_status_details�_progress_details�_spin_elements�	_spin_cur�time�_spin_stamp�_transactionr�MainLoop�_loop)�self�
show_terminal�allow_unauthenticated�details�r7�3/usr/lib/python3/dist-packages/aptdaemon/console.py�__init__=s.


zConsoleClient.__init__rc
Cs6t|�}|jj|j|j|j|j|j||j|j	d�dS)z#Add repository to the sources list.��
reply_handler�
error_handlerN)
rr�add_repository�type�uri�dist�comps�comment�_run_transaction�
_on_exception)r3�line�sourcesfile�entryr7r7r8r=Xs
�zConsoleClient.add_repositorycC�|jj||j|jd�dS�zInstall repository key file.r:N)r�add_vendor_key_from_filerCrD�r3�pathr7r7r8rJas

�z&ConsoleClient.add_vendor_key_from_filecC�|jj|||j|jd�dSrI)r�add_vendor_key_from_keyserverrCrD)r3�keyid�	keyserverr7r7r8rNhs

�z+ConsoleClient.add_vendor_key_from_keyservercCrH)zRemove repository key.r:N)r�remove_vendor_keyrCrD)r3�fingerprintr7r7r8rQo�
�zConsoleClient.remove_vendor_keycCrH)zInstall package file.r:N)r�install_filerCrDrKr7r7r8rTus
�zConsoleClient.install_filecs"�fdd�}�jj|�jd�dS)z%List the keys of the trusted vendors.cs |D]}t|�q�j��dS�N)�printr2�quit)�keys�key�r3r7r8�on_done|s
z7ConsoleClient.list_trusted_vendor_keys.<locals>.on_doner:N)r�get_trusted_vendor_keysrD)r3r[r7rZr8�list_trusted_vendor_keyszs
�z&ConsoleClient.list_trusted_vendor_keysc
Cs$|jj|||||||j|jd�dS)zCommit changesr:N)r�commit_packagesrCrD)r3�install�	reinstall�remove�purge�upgrade�	downgrader7r7r8r^�s

�zConsoleClient.commit_packagescC�|jj|j|jd�dS)zFix incomplete installsr:N)r�fix_incomplete_installrCrDrZr7r7r8rf�s
�z$ConsoleClient.fix_incomplete_installcCre)zRepair broken dependencies.r:N)r�fix_broken_dependsrCrDrZr7r7r8rg��

�z ConsoleClient.fix_broken_dependscCre)zUpdate cacher:N)r�update_cacherCrDrZr7r7r8ri�rhzConsoleClient.update_cachecCrH)zUpgrade systemr:N)r�upgrade_systemrCrD)r3�	safe_moder7r7r8rj�rSzConsoleClient.upgrade_systemcCrM)zReconfigure packages.r:N)r�reconfigurerCrD)r3�packages�priorityr7r7r8rl�s

�zConsoleClient.reconfigurecCre)zClean archives.r:N)r�cleanrCrDrZr7r7r8ro�rhzConsoleClient.cleancCs&z|j��WdStyYdSw)z%Start the console client application.N)r2�run�KeyboardInterruptrZr7r7r8rp�s
�zConsoleClient.runcCs�|jD]}t�|�q||_g|_|j�|�d|j��|j�|�d|j��|j�|�d|j��|j�|�d|j	��|j�|�d|j
��|j�|�d|j��|jr_|�
t�|j��|�|j�dS)zMonitor the given transactionzterminal-attached-changedzstatus-changedzstatus-details-changedzprogress-changedzprogress-details-changed�finishedN)rr�
source_remover0�append�connect�_on_terminal_attached�
_on_status�_on_status_details�_on_progress�_on_progress_details�_on_exitr&�set_terminal�os�ttynamer�set_allow_unauthenticatedr()r3�transaction�handlerr7r7r8�_set_transaction�s.
�����zConsoleClient._set_transactioncCs�|��|jrdt|jd|jdt�|�tf}tj�	|�|tj
kr;dtd�t�|j
�t�|j
�|jf}t|�|j��dS)z.Callback for the exit state of the transactionz[+] 100%% %s %-*.*s%s
�	z
%s: %s
%s

%s�ERRORN)�_detachr)�	ANSI_BOLDr r�get_exit_string_from_enum�
ANSI_RESET�sys�stderr�write�EXIT_FAILED�_�get_error_string_from_enum�
error_code�get_error_description_from_enum�
error_detailsrVr2rW)r3�trans�enum�output�msgr7r7r8r{�s&�


�zConsoleClient._on_exitcCsD|jr|r|js|��d|_|��dS|s d|_|��dSdS)zXCallback for the terminal-attachabed-changed signal of the
        transaction.
        FTN)r&r!�_clear_progressr)�_attachr�)r3r��attachedr7r7r8rv�s�z#ConsoleClient._on_terminal_attachedcCst�|�|_|��dS)z1Callback for the Status signal of the transactionN)r�get_status_string_from_enumr$�_update_progress)r3r��statusr7r7r8rw�szConsoleClient._on_statuscC�||_|��dS)z9Callback for the StatusDetails signal of the transaction.N)r*r�)r3r��textr7r7r8rx��z ConsoleClient._on_status_detailscCsj|r|rtd�t�|�t�|�t�|�d�|_n|r,td�t�|�t�|�d�|_nd|_|��dS)z;Callback for the ProgressDetails signal of the transaction.z0Downloaded %(cur)sB of %(total)sB at %(rate)sB/s)�cur�total�ratez!Downloaded %(cur)sB of %(total)sB)r�r�rN)r�r�get_size_stringr+r�)r3r��
items_done�items_total�
bytes_done�bytes_total�speed�etar7r7r8rz�s"������z"ConsoleClient._on_progress_detailscCr�)z3Callback for the Progress signal of the transactionN)r%r�)r3r��percentr7r7r8ryr�zConsoleClient._on_progresscCs�|jsdSt|jt}|jr|d|j7}|jr |d|j7}|jd}|jdt��kr>|j	dt
|j�|_	t��|_|j|j	}|jdkrLd}n|j}t
j�d	|d
|d|||fd�dS)
zUpdate the progress bar.N� z (%s)r�g�������?r
�d�---�[%s] �%3.3s%% �%-*.*s�
)r)r�r$r�r*r+r r/r.r-�lenr,r%r�r�r�)r3r��
text_width�spinnerr�r7r7r8r�s,


��
�zConsoleClient._update_progressNcCs�t|t}|jd}|r$|jdt|j�|_t��|_|j|j}nd}|dur,d}tj	�
d|d|d|||fd	�d
S)z5Update the progress bar with a custom status message.r�r
�+Nr�r�r�r�r�T)r�r�r r-r�r,r.r/r�r�r�)r3r�r��spinr�r�r�r7r7r8�_update_custom_progress#s"

���z%ConsoleClient._update_custom_progresscCs|jdur
t�|j�dSdS)z7Stop the spinner which shows non trans status messages.N)�_progress_idrrsrZr7r7r8�_stop_custom_progress6s
�z#ConsoleClient._stop_custom_progresscCstj�d|j|jdf�dS)z%Clear progress information on stderr.z%-*.*s
r�N)r�r�r�r rZr7r7r8r�;s�zConsoleClient._clear_progresscCs0|jr|jjtjkr|j��dS|j��dS)zCallback for a cancel signal.N)r0r�r�STATUS_SETTING_UP�cancelr2rW�r3�signum�framer7r7r8rAszConsoleClient._on_cancel_signalcCs|��|_|��dS)z%Callback for a changed terminal size.N)rr r�r�r7r7r8rIs
z!ConsoleClient._on_terminal_resizecCs8|jD]}t�|�q|jrt�tjtj|j�dSdS)z.Dettach the controlling terminal to aptdaemon.N)	r!rrsr"�tty�	tcsetattrr�STDIN_FILENO�	TCSAFLUSH)r3�widr7r7r8r�Ns
��zConsoleClient._detachc	Cs�zt�tj�|_t�tj�Wn
tjyd|_Ynwtjtj	Btj
B}|j�t�
tjtj||j|j��|j�t�
|jtj||jtj��dS)zSAttach the controlling terminal to aptdaemon.
        Based on pty.spwan()
        N)r��	tcgetattrrr�r"�setraw�errorr�IO_IN�IO_ERR�IO_HUPr!rt�io_add_watch�PRIORITY_HIGH_IDLE�_copy_ior�
STDOUT_FILENO)r3�flagsr7r7r8r�Vs$
���
��zConsoleClient._attachcCs8|tjkrt�|d�}|rt�||�dSt�|�dS)z(Callback to copy data between terminals.iTF)rr�r}�readr��close)r3�source�	condition�target�datar7r7r8r�hs

zConsoleClient._copy_iocCs6zt�dt�tjtjd��dWStyYdSw)z7Return the witdh in characters of the current terminal.�hzr
�P)�array�fcntl�ioctlr�r��termios�
TIOCGWINSZ�IOErrorrZr7r7r8rrs���z!ConsoleClient._get_terminal_widthcCs�|��z|�tjydtd�td�|��f}Yntjy3dtd�|��|��f}Ynt|�}Y|j	�
�t�|�dS)zError callback.z	%s %s

%szERROR:z+You are not allowed to perform this action.z
%s %s - %sN)
r�r
�PolicyKitErrorr��get_dbus_message�dbus�
DBusException�
get_dbus_name�strr2rWr��exit)r3r�r�r7r7r8rD{s 
�
�

zConsoleClient._on_exceptioncs���|�����jjtjtjtjtjtj	fvr3t
�d�jt
d���_�jj�j�fdd�d�dSt
�d�jt
d���_�jj�j�jd�dS)	z,Callback which runs a requested transaction.��Queuingc����SrU�r�r7rZr7r8�<lambda>��z0ConsoleClient._run_transaction.<locals>.<lambda>�r<r;zResolving dependenciesr:N)r�r�r0�roler�ROLE_UPDATE_CACHE�ROLE_ADD_VENDOR_KEY_FILE�"ROLE_ADD_VENDOR_KEY_FROM_KEYSERVER�ROLE_REMOVE_VENDOR_KEY�ROLE_FIX_INCOMPLETE_INSTALLr�timeout_addr�r�r�rprD�simulate�
_show_changes)r3r�r7rZr8rC�s.

��

��

�zConsoleClient._run_transactioncs�fdd�}�������jj\}}}}}}�jj\}}	}
}}}
}|�|�|�|�|�|�|�|
�|�|�|�|	�|�|
�|}|r^ttddt|��dt|�i�||�|rtttddt|��dt|�i�||�|r�ttdd	t|��dt|�i�||�|r�ttd
dt|��dt|�i�||�|r�ttdd
t|��dt|�i�||�|r�ttddt|��dt|�i�||��jj	r�tt
d�t��jj	���jj
dkr�tt
d�t��jj
��n�jj
dk�rtt
d�t��jj
���jj
�s!�jj	�s!|�s!|�s!|�s!|�s!|�s!|�rgzt�r,tt
d��}ntt
d��}Wnt�y?d}Ynwt�t�tj�|��sg|dk�rgt�tj�}��|dd��j��t�d�t� d�jt
d���_!�jj"�j#�fdd�d�dS)Nc	s�d}|��|D]I}z|�dd�dd�\}}Wn
ty%|}d}Ynw�jr2|r2d||f}n|}t|�dt|��jkrK|dkrKt|�d}|d|7}q|dkr\t|�dSdS)	zFormat the pkgs in a nice way.r��=r
rrNz%s=%sz %s)�sort�split�
ValueErrorr'r�r rV)�pkgsrE�pkg�name�versionr�rZr7r8�
show_packages�s(�
�z2ConsoleClient._show_changes.<locals>.show_packagesz8The following NEW package will be installed (%(count)s):z9The following NEW packages will be installed (%(count)s):�countz3The following package will be upgraded (%(count)s):z4The following packages will be upgraded (%(count)s):z2The following package will be REMOVED (%(count)s):z3The following packages will be REMOVED (%(count)s):z5The following package will be DOWNGRADED (%(count)s):z6The following packages will be DOWNGRADED (%(count)s):z6The following package will be reinstalled (%(count)s):z7The following packages will be reinstalled (%(count)s):z5The following package has been kept back (%(count)s):z7The following packages have been kept back (%(count)s):zNeed to get %sB of archives.rz@After this operation, %sB of additional disk space will be used.zAAfter this operation, %sB of additional disk space will be freed.zDo you want to continue [Y/n]?�nrFr
r�r�cr�rUr�r7rZr7r8r�r�z-ConsoleClient._show_changes.<locals>.<lambda>r�)$r�r�r0rm�dependencies�extendrVrr��downloadr�rr��space�PY3K�input�	raw_input�EOFError�re�match�locale�nl_langinfo�YESEXPRrr��EXIT_CANCELLEDr�r2rWr�r�rr�r�rprD)r3r��installs�
reinstalls�removals�purges�upgrades�
downgrades�dep_installs�dep_reinstalls�dep_removals�
dep_purges�dep_upgrades�dep_downgrades�	dep_kepts�kepts�contr�r7rZr8r��s���






�
��
��
��
��
��
������������


�

�zConsoleClient._show_changes)TFF)rr)NT)'�__name__�
__module__�__qualname__�__doc__r9r=rJrNrQrTr]r^rfrgrirjrlrorpr�r{rvrwrxrzryr�r�r�r�rrr�r�r�rrDrCr�r7r7r7r8r9sN
�
		

	rc	Cs�td�}ttj|d�}|jdddddtd�d	�|jdd
dddtd�d	�|jdd
dddtd�d	�|jddddddtd�d�|jddddddtd�d�|jddddddtd�d�|jdddddd td!�d�|jd"d#dddd$td�d�|jdd%dddd&td'�d�|jdd(dd)td*�d+�|jdd,dd)td-�d+�|jdd.dd/td0�d+�|jdd1dddd2td3�d�|jdd4dddtd5�d6�|jdd7dddtd8�d6�|jdd9dddd:td;�d�|jdd<dddd=td>�d?�|jdd@dddAtdB�d	�|jddCddddDtdE�d�|jddFddGtdH�d+�|jddIddddJtdK�d�|jddLdMdddNtdO�d�|jddPddQtdR�d+�|jddSddTdUtdV�dW�|jdXdYddZtd[�d+�|��\}}t|j|j|j	d\�}t
�d]|jtd^��|_
|j�r||�d_�n�|j�r�|�dU�n�|j�r�|��n�|j�r�|�|j��|j�n�|j�r�|��n�|j�r�|��n�|j�r�|��n�|j�r�|j�d`��r�|�|j�n{|j�s�|j�s�|j�s�|j �s�|j!�s�|j"�r|�#|j��|j��|j��|j ��|j!��|j"���nF|j$�r
|�$|j$|j%�n9|j&�r|�'|j&�n.|j(�r)|j)�r)|�(|j(|j)�n|j*�r4|�*|j*�n|j+�r=|�+�n	|�,�t-�.da�|�/�dbS)cz'Run a command line client for aptdaemonziTo operate on more than one package put the package names in quotation marks:
aptdcon --install "foo bar")r��epilogz-cz	--refreshr�
store_true�refreshzRefresh the cache)�default�action�dest�helpz
--fix-depends�fix_dependszoTry to resolve broken dependencies. Potentially dangerous operation since it could try to remove many packages.z
--fix-install�fix_installz1Try to finish a previous incompleted installationz-iz	--install�store�stringr_zInstall the given packages)r"r#r>r$r%z--reinstallr`zReinstall the given packagesz-rz--removerazRemove the given packagesz-pz--purgerbz7Remove the given packages including configuration filesz-uz	--upgradercz--downgraderdzDowngrade the given packagesz--upgrade-system�safe_upgradez%Deprecated: Please use --safe-upgrade)r#r$r%z--safe-upgradez Upgrade the system in a safe wayz--full-upgrade�full_upgradez=Upgrade the system, possibly installing and removing packagesz--add-vendor-key�add_vendor_keyz"Add the vendor to the trusted onesz--add-vendor-key-from-keyserverz-Add the vendor keyid (also needs --keyserver))r"r#r>r%z--keyserverz+Use the given keyserver for looking up keysz--add-repositoryr=z*Add new repository from the given deb-linez--sources-file�sources_filezQSpecify an alternative sources.list.d file to which repositories should be added.)r#r"r>r$r%z--list-trusted-vendorsr]zList trusted vendor keysz--remove-vendor-keyrQz/Remove the trusted key of the given fingerprintz--cleanrozRemove downloaded package filesz
--reconfigurerlz]Reconfigure installed packages. Optionally the minimum priority of questions can be specifiedz
--priorityr"rnz8The minimum debconf priority of question to be displayedz--hide-terminal�
hide_terminalz!Do not attach to the apt terminalz--allow-unauthenticatedr5Fz+Allow packages from unauthenticated sources)r#r$r"r%z-dz--show-detailsr6zQShow additional information about the packages. Currently only the version number)r4r5r6r�zWaiting for authenticationTz.debr
N)0r�r�	aptdaemon�__version__�
add_option�
parse_argsrr.r5r6rr�r�r�r*rjr+r!rirlr�rnror'rfr&rgr_�endswithrTr`rarbrcrdr^r=r-r,rJrNrPrQr]�
print_helpr�r�rp)r�parser�options�args�conr7r7r8rs:
�
�
�
�
�
�
�
�
����
�
�
�
��
�
��
�
�����
�



�����

r�__main__)*r�
__author__�__all__r�r�rr�rr�optparserr}rrr�r.r�rr��aptsources.sourceslistr�
gi.repositoryr�dbus.mainloop.glibr��mainloop�glib�
DBusGMainLoopr/rrrr
�chrr�r��version_info�majorrrrrr7r7r7r8�<module>sJi
�

Youez - 2016 - github.com/yon3zu
LinuXploit