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/lib/python3/dist-packages/jeepney/io/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


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

Current File : /usr/lib/python3/dist-packages/jeepney/io/__pycache__/trio.cpython-310.pyc
o

���`:�@s�ddlZddlmZddlZddlmZddlZddlmZzddlm	Z	Wne
y5ddlm	Z	Ynwddlm
Z
mZddlZddlmZddlmZmZdd	lmZdd
lmZmZddlmZmZmZddlmZm Z dd
l!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(e�)e*�Z+gd�Z,edd��Z-Gdd�de�Z.d%dd�de.fdd�Z/Gdd�de%�Z0Gdd�d�Z1Gdd �d �Z2Gd!d"�d"e�Z3e	d%dd�d#d$��Z4dS)&�N)�contextmanager)�count)�Optional)�asynccontextmanager)�Value�Error)�Channel)�
Authenticator�BEGIN)�get_bus)�FileDescriptor�fds_buf_size)�Parser�MessageType�Message)�	ProxyBase�
unwrap_msg)�message_bus�)�MessageFilters�FilterHandle�ReplyMatcher�RouterClosed�check_replyable)�open_dbus_connection�open_dbus_router�Proxyc
csX�zdVWdSty+}z|jtjtjhvrt�d�d�t�d�|��|�d}~ww)Nzthis socket was already closedzsocket connection broken: {})�OSError�errno�EBADF�ENOTSOCK�trio�ClosedResourceError�BrokenResourceError�format)�exc�r&�1/usr/lib/python3/dist-packages/jeepney/io/trio.py�)_translate_socket_errors_to_stream_errors0s�����r(c@s~eZdZdZddd�Zdd�defdd	�Zd
efdd�Zdd
e	fdd�Z
defdd�Zdd�Zdd�Z
dd�Zedd��ZdS)�DBusConnectiona�A plain D-Bus connection with no matching of replies.

    This doesn't run any separate tasks: sending and receiving are done in
    the task that calls those methods. It's suitable for implementing servers:
    several worker tasks can receive requests and send replies.
    For a typical client pattern, see :class:`DBusRouter`.

    Implements trio's channel interface for Message objects.
    FcCsD||_||_t�|_tdd�|_d|_t��|_	t��|_
d|_dS)Nr)�start)�socket�
enable_fdsr�parserr�outgoing_serial�unique_namer!�Lock�	send_lock�	recv_lock�_leftover_to_send)�selfr+r,r&r&r'�__init__Is


zDBusConnection.__init__N��serial�messagec	�s��|j4IdH�/|durt|j�}|jrt�d�nd}|j||d�}|�||�IdHWd�IdHdS1IdHs=wYdS)z.Serialise and send a :class:`~.Message` objectN�i)�fds)r1�nextr.r,�array�	serialise�
_send_data)r4r8r7r:�datar&r&r'�sendSs�
.�zDBusConnection.sendr?c	�s��|jjr
t�d��t��Y|jr|�|j�IdHt|��0}|r5|j�|gtjj	tjj
|fg�IdH}n	|j�|�IdH}|�||�IdHWd�n1sQwYWd�dSWd�dS1siwYdS)Nz!can't send data after sending EOF)r+�did_shutdown_SHUT_WRr!r"r(r3�_send_remainder�
memoryview�sendmsg�
SOL_SOCKET�
SCM_RIGHTSr@)r4r?r:�sentr&r&r'r>^s"�


���"�zDBusConnection._send_datarc�s��z5|t|�kr1||d��}|j�|�IdH}Wd�n1s"wY||7}|t|�ksd|_WdStjyF||d�|_�w�N)�lenr+r@r3r!�	Cancelled)r4r?�already_sent�	remainingrGr&r&r'rBqs����zDBusConnection._send_remainder�returnc	�s��|j4IdH�/	|j��}|dur|Wd�IdHS|��IdH\}}|s/t�d��|j�||�q
1IdHs=wYdS)z5Return the next available message from the connectionNTzSocket closed at the other end)r2r-�get_next_message�
_read_datar!�EndOfChannel�add_data)r4�msg�br:r&r&r'�receives�
�
��zDBusConnection.receivec�s��|jrC|j��}t��|j�|t��IdH\}}}}Wd�n1s&wY|ttjdd�@r<|�	�t
d��|t�|�fSt��|j�
d�IdH}Wd�|gfS1s]wY|gfS)N�
MSG_CTRUNCrz&Unable to receive all file descriptorsi)r,r-�
bytes_desiredr(r+�recvmsgr
�getattrr!�_close�RuntimeErrorr�from_ancdata�recv)r4�nbytesr?�ancdata�flags�_r&r&r'rO�s$�
��
��zDBusConnection._read_datacCs|j��d|_dSrH)r+�closer3�r4r&r&r'rY�s

zDBusConnection._closec�s�|��dS)zClose the D-Bus connectionN)rYrbr&r&r'�aclose�s�zDBusConnection.aclosec	Cs��t��4IdH�-}t|�}|�|�IdHz|VW|��IdHn|��IdHwWd�IdHdS1IdHs<wYdS)aYTemporarily wrap this connection as a :class:`DBusRouter`

        To be used like::

            async with conn.router() as req:
                reply = await req.send_and_get_reply(msg)

        While the router is running, you shouldn't use :meth:`receive`.
        Once the router is closed, you can use the plain connection again.
        N)r!�open_nursery�
DBusRouterr*rc)r4�nursery�routerr&r&r'rg�s�".�zDBusConnection.router)F)r)�__name__�
__module__�__qualname__�__doc__r5rr@�bytesr>rCrBrTrOrYrcrrgr&r&r&r'r)?s
	
r)�SESSIONF�r,rMc		�s��t|�}t�|�IdH}t|d�}|D]}|�|�IdH|�|��IdH�q|�t�IdHt|j	|d�}|�
�4IdH�}|�t�
��IdH}|jd|_Wd�IdH|S1IdHsbwY|S)zHOpen a plain D-Bus connection

    :return: :class:`DBusConnection`
    Nrnr)rr!�open_unix_socketr	�send_all�feed�receive_somer
r)r+rg�send_and_get_replyr�Hello�bodyr/)	�busr,�bus_addr�sock�authr�req_data�connrg�replyr&r&r'r�s �
��rcsFeZdZdef�fdd�Zedd��Zdd�Zdd	�Zd
d�Z	�Z
S)�TrioFilterHandle�filterscst��|||�||_dSrH)�superr5�send_channel)r4r~�rule�send_chn�recv_chn��	__class__r&r'r5�s
zTrioFilterHandle.__init__cCs|jSrH��queuerbr&r&r'�receive_channel�sz TrioFilterHandle.receive_channelc�s�|��|j��IdHdSrH)rar�rcrbr&r&r'rc�s�zTrioFilterHandle.aclosec�s�|jSrHr�rbr&r&r'�
__aenter__�s�zTrioFilterHandle.__aenter__c�s�|��IdHdSrH)rc)r4�exc_type�exc_val�exc_tbr&r&r'�	__aexit__�s�zTrioFilterHandle.__aexit__)rhrirjrr5�propertyr�rcr�r��
__classcell__r&r&r�r'r}�s
r}c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�Futurez4A very simple Future for trio based on `trio.Event`.cCsd|_t��|_dSrH)�_outcomer!�Event�_eventrbr&r&r'r5�szFuture.__init__cC�t|�|_|j��dSrH)rr�r��set)r4�resultr&r&r'�
set_result��
zFuture.set_resultcCr�rH)rr�r�r�)r4r%r&r&r'�
set_exception�r�zFuture.set_exceptionc�s�|j��IdH|j��SrH)r��waitr��unwraprbr&r&r'�get�s�
z
Future.getN)rhrirjrkr5r�r�r�r&r&r&r'r��sr�c@s�eZdZdZdZdZdefdd�Zedd��Z	dd�d	d
�Z
defdd
�Zddd�de
ejfdd�Zdejfdd�Zdd�Zdefdd�Zejfdd�ZdS)rez�A client D-Bus connection which can wait for replies.

    This runs a separate receiver task and dispatches received messages.
    Nr{cCs||_t�|_t�|_dSrH)�_connr�_repliesr�_filters)r4r{r&r&r'r5szDBusRouter.__init__cCs|jjSrH)r�r/rbr&r&r'r/szDBusRouter.unique_namer6c�s�|jj||d�IdHdS)z/Send a message, don't wait for a reply
        r6N)r�r@)r4r8r7r&r&r'r@s�zDBusRouter.sendrMc�s~�t|�|jdurtd��t|jj�}|j�|t���}|j	||d�IdH|�
�IdHWd�S1s8wYdS)z�Send a method call message and wait for the reply

        Returns the reply message (method return or error message type).
        NzThis DBusRouter has stoppedr6)r�_rcv_cancel_scoperr;r�r.r��catchr�r@r�)r4r8r7�	reply_futr&r&r'rss�
$�zDBusRouter.send_and_get_replyr)�channel�bufsizer�cCs,|durt�|�\}}nd}t|j|||�S)aCreate a filter for incoming messages

        Usage::

            async with router.filter(rule) as receive_channel:
                matching_msg = await receive_channel.receive()

            # OR:
            send_chan, recv_chan = trio.open_memory_channel(1)
            async with router.filter(rule, channel=send_chan):
                matching_msg = await recv_chan.receive()

        If the channel fills up,
        The sending end of the channel is closed when leaving the ``async with``
        block, whether or not it was passed in.

        :param jeepney.MatchRule rule: Catch messages matching this rule
        :param trio.MemorySendChannel channel: Send matching messages here
        :param int bufsize: If no channel is passed in, create one with this size
        N)r!�open_memory_channelr}r�)r4r�r�r��recv_channelr&r&r'�filter#szDBusRouter.filterrfc�s,�|jdur
td��|�|j�IdH|_dS)Nz+DBusRouter receiver task is already running)r�rZr*�	_receiver)r4rfr&r&r'r*@s�
zDBusRouter.startc�s0�|jdur|j��d|_t�d�IdHdS)z Stop the sender & receiver tasksNr)r��cancelr!�sleeprbr&r&r'rcEs
�

zDBusRouter.acloserRc	CsJ|j�|�rdS|j�|�D]}z|j�|�Wqtjy"YqwdS)zHandle one received messageN)r��dispatchr��matchesr��send_nowaitr!�
WouldBlock)r4rRr�r&r&r'�	_dispatchRs��zDBusRouter._dispatchc�s��t���K}d|_|�|�z	|j��IdH}|�|�qd|_|j��t�	d��}|j
j��D]
}d|_
|j��IdHq2Wd�w1sJwYw1sSwYdS)z'Receiver loop - runs in a separate taskTNF�)r!�CancelScope�
is_running�startedr�rTr�r��drop_all�
move_on_afterr�r~�values�shieldr�rc)r4�task_status�cscoperR�
cleanup_scoper�r&r&r'r�]s$�


�
���zDBusRouter._receiver)rhrirjrk�_nursery_mgrr�r)r5r�r/r@rrsrr!�MemorySendChannelr��Nurseryr*rcr��TASK_STATUS_IGNOREDr�r&r&r&r're�s

recs(eZdZdZ�fdd�Zdd�Z�ZS)ra�A trio proxy for calling D-Bus methods

    You can call methods on the proxy object, such as ``await bus_proxy.Hello()``
    to make a method call over D-Bus and wait for a reply. It will either
    return a tuple of returned data, or raise :exc:`.DBusErrorResponse`.
    The methods available are defined by the message generator you wrap.

    :param msggen: A message generator object.
    :param ~trio.DBusRouter router: Router to send and receive messages.
    cs(t��|�t|t�std��||_dS)Nz)Proxy can only be used with DBusRequester)rr5�
isinstancere�	TypeError�_router)r4�msggenrgr�r&r'r5~s

zProxy.__init__cs��fdd�}|S)Nc�s<��|i|��}|jjtjusJ��j�|�IdH}t|�SrH)�header�message_typer�method_callr�rsr)�args�kwargsrRr|��make_msgr4r&r'�inner�s
�z!Proxy._method_call.<locals>.innerr&)r4r�r�r&r�r'�_method_call�szProxy._method_call)rhrirjrkr5r�r�r&r&r�r'rss
rc
Cs��t||d�IdH}|4IdH�-|��4IdH�}|VWd�IdHn1IdHs-wYWd�IdHdS1IdHsCwYdS)a�Open a D-Bus 'router' to send and receive messages.

    Use as an async context manager::

        async with open_dbus_router() as req:
            ...

    :param str bus: 'SESSION' or 'SYSTEM' or a supported address.
    :return: :class:`DBusRouter`

    This is a shortcut for::

        conn = await open_dbus_connection()
        async with conn:
            async with conn.router() as req:
                ...
    rnN)rrg)rvr,r{�rtrr&r&r'r�s�*�.�r)rm)5r<�
contextlibrr�	itertoolsr�logging�typingrr�ImportError�async_generator�outcomerrr!�trio.abcr�jeepney.authr	r
�jeepney.busr�jeepney.fdsrr
�jeepney.low_levelrrr�jeepney.wrappersrr�jeepney.bus_messagesr�commonrrrrr�	getLoggerrh�log�__all__r(r)rr}r�rerrr&r&r&r'�<module>sB�

~u

Anon7 - 2022
AnonSec Team