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 :  /usr/share/system-config-printer/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/system-config-printer/__pycache__/asyncipp.cpython-310.pyc
o

3�b�h�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddlZe�	d�ddl
Z
ddlTddlZddlZej
ejejd�Gd	d
�d
ej�ZGdd�d�ZGd
d�d�ZGdd�de�Zedkr}ed�Gdd�d�Ze�e��dSdS)�N)�GObject)�GLib)�Gdk)�Gtkz1.9.60)�*)�domain�	localedirc@sVeZdZ			ddd�Zdd�Zdd�Zdd	�Zd
d�Zddd
�Zdd�Z	dd�Z
dS)�_IPPConnectionThreadNc

Csntj�|�|�d�||_||_||_||_|	|_||_	||_
||_t�
d�|_||_d|_td|�dS)NT�F�+%s)�	threading�Thread�__init__�	setDaemon�_queue�_conn�host�port�_encryption�_reply_handler�_error_handler�
_auth_handler�queue�Queue�_auth_queue�user�
_destroyed�
debugprint)
�self�myqueue�conn�
reply_handler�
error_handler�auth_handlerrrr�
encryption�r%�,/usr/share/system-config-printer/asyncipp.pyr0s
z_IPPConnectionThread.__init__cC�t�d|�dS�Nz-%s��debugr�rr%r%r&�__del__C�z_IPPConnectionThread.__del__cCs|j�|�dS�N)r�put�r�passwordr%r%r&�
set_auth_infoFsz"_IPPConnectionThread.set_auth_infoc
Cs�|jdur
t��|_|jdurt��|_|jdurt��|_|jr(t�|j�nt�	�|_t�
|j�ztj|j|j|jd�}|�
d�Wnty^}z
d}|�|�WYd}~nd}~ww	td�|j��|_|j��}tdt|��|dur�|j��n�|jr�|j��q_d|_|\}}}}}}	|dkr�||_|dkr�||_|	dkr�|	|_|dk�r|d|_t�|j�td|j�t�
|j�ztj|j|j|jd�}td�|j��|�
d�Wn!t�y}ztd	�|j��|�|�WYd}~nd}~wwq_z0td
|�||g|�Ri|��}
|tjjjk�r+|
ik�r+t�tjd��td�|�
|
�Wn t�yU}ztd
t|��|�|�WYd}~nd}~ww|j��q`td�|` |`|`|`|`|`!~t�
d�dS)N)rrr$TzAwaiting further instructionsz
Next task: %sFrzSet user=%s; reconnecting...z...reconnectedz	...failedzCall %s�z
...successz...failure (%s)zThread exiting)"r�cups�	getServerr�getPortr�
getEncryptionr�setUser�getUser�setPasswordCB2�_auth�
Connection�_reply�RuntimeError�_errorrr�empty�idle�get�repr�	task_donerrrr�adminGetServerSettings�__call__�IPPError�IPP_NOT_AUTHORIZED�	Exceptionrr)rr �e�item�fn�args�kwds�rh�eh�ah�resultr%r%r&�runIs�






���




�

��
��
�@z_IPPConnectionThread.runcCsd|_|j�d�dS)NT)rrr/r+r%r%r&�stop�sz_IPPConnectionThread.stopcs:����fdd�}�jdurdSt�||��j��}|S)Ncs>t���dur��|�j�n	��|�j���t��dS�NF)r�
threads_enterrr�
threads_leave)�prompt�r �method�resourcerr%r&�prompt_auth�sz/_IPPConnectionThread._auth.<locals>.prompt_authr3)rr�idle_addrrB)rrXr rZr[r\r1r%rYr&r;�s


z_IPPConnectionThread._authcs4�fdd�}�js�jrt�|�j|�dSdSdS)Nc�&�jst��|�j|�t��dSrU�rrrVrrW)�handlerrRr+r%r&�
send_reply��
z/_IPPConnectionThread._reply.<locals>.send_reply)rrrr])rrRrar%r+r&r=�s�z_IPPConnectionThread._replycsB�fdd�}�js�jrtd�j�t�|�j|�dSdSdS)Ncr^rUr_)r`�excr+r%r&�
send_error�rbz/_IPPConnectionThread._error.<locals>.send_errorzAdd %s to idle)rrrrr])rrcrdr%r+r&r?�s
�z_IPPConnectionThread._error)NNNNNNN)NNN)�__name__�
__module__�__qualname__rr,r2rSrTr;r=r?r%r%r%r&r	/s
�c
r	c@sZeZdZdZ			ddd�Zdd�Zdd�Zd	d
�Zdd�Zdd
d�Z	dd�Z
dd�ZdS)�
IPPConnectiona�
    This class starts a new thread to handle IPP operations.

    Each IPP operation method takes optional reply_handler,
    error_handler and auth_handler parameters.

    If an operation requires a password to proceed, the auth_handler
    function will be called.  The operation will continue once
    set_auth_info (in this class) is called.

    Once the operation has finished either reply_handler or
    error_handler will be called.
    Nc	
Cs�td�||_t��|_t|j||||||||d�	|_|j��ttj	j
�}	g}
ttj	�D]$}|ddkr6q-ttj	|�}t|�|	krCq-t
|||�|��|
�|�q-|
|_td|�dS)NzNew IPPConnection�r!r"r#rrrr$r� r)r�_parentrrr	�thread�start�typer4r<�getPrinters�dir�getattr�setattr�
_make_binding�append�bindings)
rr!r"r#rrrr$�parent�
methodtyperu�fnamerLr%r%r&r�s.
�
zIPPConnection.__init__cCr'r(r)r+r%r%r&r,r-zIPPConnection.__del__cCsTtd|�|jD]}t||�q	|j��r(td�|j��t�d|j�dSdS)NzDESTROY: %szStopping worker threadr
)	rru�delattrrl�is_aliverTr�timeout_add_seconds�_reap_thread)r�bindingr%r%r&�destroys


�zIPPConnection.destroycCs(|jjr|j��dStd|j�dS)NFz Thread %s still processing tasksT)rlrAr�joinrr+r%r%r&r|s

zIPPConnection._reap_threadcCs|j�|�dS)z*Call this from your auth_handler function.N)rlr2r0r%r%r&r2szIPPConnection.set_auth_infocCs&td�|j�d|fi||df�dS)NzReconnect...TF)rrr/)rrr!r"r%r%r&�	reconnect!s
�zIPPConnection.reconnectcs��fdd�S)Ncs�j�g|�Ri|��Sr.)�_call_function)rMrN�rLrr%r&�<lambda>'sz-IPPConnection._make_binding.<locals>.<lambda>r%)rrLr%r�r&rs&szIPPConnection._make_bindingcOsjd}}}d|vr|d}|d=d|vr|d}|d=d|vr'|d}|d=|j�||||||f�dS�NFr!r"r#)rr/)rrLrMrNr!r"r#r%r%r&r�)s
�zIPPConnection._call_function)NNNNNNNN�NN)rerfrg�__doc__rr,r~r|r2r�rsr�r%r%r%r&rh�s
�

rhc@sjeZdZ	ddd�Zdd�Zdd�Zdd	�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�_IPPAuthOperationNcCshd|_d|_d|_d|_d|_d|_||_||_|jj|_	||_
||_||_||_
||_td|�dS)NFr3r)�_auth_called�
_dialog_shown�
_use_password�_cancel�
_reconnect�_reconnected�_userr�try_as_root�_try_as_root�
_client_fn�_client_args�_client_kwds�_client_reply_handler�_client_error_handlerr)rr!r"r rrLrMrNr%r%r&rAs
z_IPPAuthOperation.__init__cCr'r(r)r+r%r%r&r,Tr-z_IPPAuthOperation.__del__cCs|`|`|`|`|`|`dSr.)rr�r�r�r�r�r+r%r%r&�_destroyWsz_IPPAuthOperation._destroyc	Cs�|jdurtd�|�||�S|jrtd|�|�|�S|jr<d|_d|_td||jf�|j|j|j	|jd�dSd}t
|�tjkro|j
\}}|tjksY|tjksY|tjkr_|tjk}n5|tjkrj|�||�S|�|�St
|�tjkr�|j
\}|tjks�|tjkr�|tjk}n
|�|�S|�|�S|r�td|�ntd|�|jr�|jd	kr�|jjjd
dks�|r�td�d	|_|j|j|j	|jd�dS|js�|�|�S|jj}|jj}tjj||d
�d|_td||jf�|j|j|j	|jd�dS)NzConnection/reconnection failedz,%s (_error_handler): canceled so chaining upFTz,%s (_error_handler): reconnecting (as %s)...�r!r"z%s (_error_handler): forbiddenz#%s (_error_handler): not authorized�rootr�/zAuthentication: Try as root�rrr3)r�r�_reconnect_errorr�r?r�r�r�r��_reconnect_replyrnr4rGrMrH�
IPP_FORBIDDEN�IPP_AUTHENTICATION_CANCELED�IPP_SERVICE_UNAVAILABLE�	HTTPError�HTTP_UNAUTHORIZED�HTTP_FORBIDDENr�rrlrr�r�authconn�global_authinfocache�remove_auth_infor�)	rr rc�	forbiddenrJ�m�srrr%r%r&r"_s|

��










	�
��
�z_IPPAuthOperation.error_handlercCs�|jdkr5|jdurt��|_|jr4|jj}|jj}tjj	||d�}|r4|d|jkr3|d|_
d|_~n|jj}|jj}tjj||d�d|_
d|_|jr]t
d�d|_|�|j
�dSd|_|jsk|�|j
�dS|jr�tj|jjddtjjtjjtd�d	�}|�td
��|��|��d}	|jr�|j��}	|	dur�tj|jd�}ntd�|	}
tj|
|jd
�}|� d�|jdur�t��|_|�ddg�|�!d�|�"d�|�#�|�$d|j%�d|_dS)NFr�rr
Tr3z%Supplying password after reconnectionzNot authorized�rv�modal�destroy_with_parent�message_type�buttons�textzThe password may be incorrect.)rvzAuthentication (%s))�titlerv�username�response)&r�r�r4r9rlrrr�r��lookup_auth_infor�r�r�rr2�prompt_allowedr�r�
MessageDialogrrv�MessageType�ERROR�ButtonsType�CLOSE�_�format_secondary_textrSr~�semantic�current_operation�
AuthDialog�
set_prompt�field_grab_focus�set_keep_above�show_all�connect�_on_auth_dialog_response)rrXr rZr[rr�creds�d�opr�r%r%r&r#�sv


�
��
�
�





z_IPPAuthOperation.auth_handlercCs0d|_|jj�|j|j|j|j|j|j	f�dSrU)
r�rrr/r�r�r�r�r"r#r+r%r%r&�submit_task�s
�z_IPPAuthOperation.submit_taskcCs�|��\}}|dkr
|j}tjj||f|jjj|jjjd�||_	|�
�|tjj
ks1|tjjkrNd|_|j�d�tjj|jjj|jjjd�td�dS||jkrb||_|j�|�td�dS||_||_d|_|j�d�td|j�dS)Nr3r�Tz
Auth canceledzPassword supplied.zWill try as %s)�
get_auth_infor�r�r��cache_auth_inforrlrr�_dialog�hider�ResponseType�CANCEL�DELETE_EVENTr�r2r�rr�r�)r�dialogr�rr1r%r%r&r��s<���
z*_IPPAuthOperation._on_auth_dialog_responsecCs(td|j�|jdur|��dSdS)NzConnected as %s)rr�r�r��rr rRr%r%r&r�s
�z"_IPPAuthOperation._reconnect_replycCs td|j�|jjs|�|�dSd}|jr|j��}|dur%td�}ntd�|}tj	|jj
ddtjjtj
j|d�}|jdurJt|�tkrJd}nt|�tjkrW|jd}nt|�}|�td|��|�tjtjjtd	�tjj�|�tjj�|�d
|j�td|||f�|��dS)NzFailed to connect as %szCUPS server errorzCUPS server error (%s)Tr�z!service-error-service-unavailabler
z3There was an error during the CUPS operation: '%s'.�Retryr�z7%s (_reconnect_error): presenting error dialog (%s; %s)) rr�rr�r?r�r�r�rr�rvr�r�r��NONEr�rnr>r4rGrMrCr��add_buttons�STOCK_CANCELr�r��OK�set_default_responser��_on_retry_server_error_response�show)rr rcr��msgr��messager%r%r&r�%sB



����z"_IPPAuthOperation._reconnect_errorcCsp|��|tjjkr%td||jjjf�|jj|jjj|j	|j
d�dStd|�|�t�
dtd���dS)Nz/%s: got retry response, reconnecting (as %s)...r�z%s: got cancel responserzOperation canceled)r~rr�r�rrrlrr�r�r�r?r4rGr�)rr�r�r%r%r&r�Ls�
�z1_IPPAuthOperation._on_retry_server_error_responsecCsVtd|t|�f�|jr#td||jf�|�|j|�|��dStd|�dS)Nz%s (_error): handling %sz%s (_error): calling %sz(%s (_error): no client error handler set)rrCr�rr�)rrcr%r%r&r?Xs�z_IPPAuthOperation._error)NNNNr�)rerfrgrr,r�r"r#r�r�r�r�r�r?r%r%r%r&r�@s
�
SA
 'r�c@s.eZdZ				d	dd�Zdd�Zdd�ZdS)
�IPPAuthConnectionNTc
Csx||_|	|_||_|
|_d}tjj||d�}|r%|ddks |r$|d}~t|||�}
tj	|||
j
|
j||||d�dS)Nr�rr�ri)rvr�r�r�r�r�r�r�rhrr"r#)rr!r"r#rrr$rvr�r�r�rr�r�r%r%r&rfs$�
�zIPPAuthConnection.__init__cCsd|_t�|�dSr.)r�rhr~r+r%r%r&r~~szIPPAuthConnection.destroycOsrd}}}d|vr|d}|d=d|vr|d}|d=d|vr'|d}|d=t||||jj|||�}|��dSr�)r�rlrr�)rrLrMrNr!r"r#r�r%r%r&r��s�z IPPAuthConnection._call_function)
NNNNNNNTTN)rerfrgrr~r�r%r%r%r&r�es
�r��__main__Tc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�UIcCs�t��}|�d|j�tj�d�}|�d|j�t��}|�|ddd�|�	|�tj�d�|_
|j
�d|j�|j
�d�|�|j
ddd�d|_
|��dS)Nr~�Connect�clickedFrzGet Devices)r�Windowr�r~�Button�new_with_label�connect_clicked�VBox�
pack_start�add�get_devices_button�get_devices�
set_sensitiver r�)r�w�b�vboxr%r%r&r�s
zUI.__init__cCs.z|j��Wn	tyYnwt��dSr.)r r~�AttributeErrorr�	main_quit)r�windowr%r%r&r~�s�z
UI.destroycCs&|jr|j��t|j|jd�|_dS)Nr�)r r~r��	connected�connect_failed�r�buttonr%r%r&r��s

�zUI.connect_clickedcCs tdt|��|j�d�dS)NzSuccess: %sT)rrCr�r�r�r%r%r&r��szUI.connectedcCs*tdt|��|j�d�|j��dS)NzExc %sF)rrCr�r�r r~�rr rcr%r%r&r��szUI.connect_failedcCs*|�d�td�|jj|j|jd�dS)NFzGetting devicesr�)r�rr �
getDevices�get_devices_reply�get_devices_errorr�r%r%r&r��s



�zUI.get_devicescC�6||jkrtd�dStdt|��|j�d�dS)NzIgnoring stale replyzGot devices: %sT�r rrCr�r�r�r%r%r&r���

zUI.get_devices_replycCr�)NzIgnoring stale errorzError getting devices: %sTr�r�r%r%r&r��r�zUI.get_devices_errorN)rerfrgrr~r�r�r�r�r�r�r%r%r%r&r��sr�)r�configr4�
gi.repositoryrrrrr�requirer�r*�gettext�install�PACKAGErr
r	rhr�r�re�
set_debuggingr��mainr%r%r%r&�<module>s6
/c'1>�

Youez - 2016 - github.com/yon3zu
LinuXploit