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__/blocking.cpython-310.pyc
o

���`�.�@s�dZddlZddlmZddlmZddlZddlmZddl	Z	ddl
mZmZddl
Z
ddlZddlmZddlmZmZmZmZdd	lmZmZdd
lmZddlmZmZddlmZm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(gd�Z)Gdd�d�Z*dd�Z+dd�Z,Gdd�d�Z-Gdd�de-�Z.Gdd�de�Z/dd�Z0d+d"e
j
fd#d$�Z1	&d,d"e.fd'd(�Z2e3d)kr�e2�Z4e5d*e4j6�dSdS)-z'Synchronous IO wrappers around jeepney
�N)�deque)�
ECONNRESET)�count)�DefaultSelector�
EVENT_READ)�Optional)�Parser�Message�MessageType�HeaderFields)�
Authenticator�BEGIN)�get_bus)�FileDescriptor�fds_buf_size)�	ProxyBase�
unwrap_msg)�Router)�message_bus�)�MessageFilters�FilterHandle�check_replyable)�open_dbus_connection�DBusConnection�Proxyc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_FuturecCs
d|_dS�N��_result��self�r"�5/usr/lib/python3/dist-packages/jeepney/io/blocking.py�__init__�
z_Future.__init__cCs
t|j�Sr)�boolrr r"r"r#�done"r%z_Future.donecC�d|f|_dS�NFr)r!�	exceptionr"r"r#�
set_exception%�z_Future.set_exceptioncCr()NTr)r!�resultr"r"r#�
set_result(r,z_Future.set_resultcCs|j\}}|r	|S|�rr)r!�success�valuer"r"r#r-+s
z_Future.resultN)�__name__�
__module__�__qualname__r$r'r+r.r-r"r"r"r#rsrcCs|dur
t��|SdSr)�time�	monotonic��timeoutr"r"r#�timeout_to_deadline2sr8cCs|dur
t|t��d�SdS)Ng)�maxr4r5)�deadliner"r"r#�deadline_to_timeout7sr;c@sxeZdZdZddejfdd�Zdd�Zdd	�Zd
ede	e
ejffdd
�Zdd�Z
dd�Zddd�Zdd�Zdd�ZdS)�DBusConnectionBasez8Connection machinery shared by this module and threadingF�sockcCsB||_||_t�|_tdd�|_t�|_|j�|t	�|_
d|_dS)Nr)�start)r=�
enable_fdsr�parserr�outgoing_serialr�selector�registerr�
select_key�unique_name)r!r=r?r"r"r#r$?s
zDBusConnectionBase.__init__cCs|Srr"r r"r"r#�	__enter__HszDBusConnectionBase.__enter__cCs|��dSr))�close)r!�exc_type�exc_val�exc_tbr"r"r#�__exit__KszDBusConnectionBase.__exit__�message�returncCs<|dur	t|j�}|jrt�d�nd}|j||d�}||fS)N�i)�serial�fds)�nextrAr?�array�	serialise)r!rLrOrP�datar"r"r#�
_serialiseOs

zDBusConnectionBase._serialisecCsD|j�|gtjtj|fg�}|t|�kr |j�||d��dSdSr)r=�sendmsg�socket�
SOL_SOCKET�
SCM_RIGHTS�len�sendall)r!rTrP�
bytes_sentr"r"r#�_send_with_fdsVs��z!DBusConnectionBase._send_with_fdscCs>	|j��}|dur|S|jt|�d�\}}|jj||d�q)NTr6)rP)r@�get_next_message�_read_some_datar;�add_data)r!r:�msg�brPr"r"r#�_receive_s
�zDBusConnectionBase._receiveNcCsN|j�|�D]\}}||jkr$|jr|��St|j�d��gfSqt�)Ni)	rB�selectrDr?�_read_with_fds�unwrap_readr=�recv�TimeoutError)r!r7�key�evr"r"r#r_hs
�z"DBusConnectionBase._read_some_datacCsT|j��}|j�|t��\}}}}|ttdd�@r!|��td��t	|�t
�|�fS)N�
MSG_CTRUNCrz&Unable to receive all file descriptors)r@�
bytes_desiredr=�recvmsgr�getattrrWrG�RuntimeErrorrfr�from_ancdata)r!�nbytesrT�ancdata�flags�_r"r"r#rers
z!DBusConnectionBase._read_with_fdscCs|j��|j��dS)zClose the connectionN)rBrGr=r r"r"r#rGzs
zDBusConnectionBase.close�Fr)r1r2r3�__doc__rWr$rFrKr	�bytesrrRrUr]rcr_rerGr"r"r"r#r<=s		
	
r<cs�eZdZddejf�fdd�
Zddefdd�ZeZdd	�d
efdd�Zdd	�d
d�Z	ddd�dd�Z
ddd�deefdd�Z
dd	�d
efdd�Z�ZS)rFr=csJt��||�d|_tt�|_t�|_tt	|�|_
|j
��}|d|_dS)NFr)
�superr$�
_unwrap_replyrr�routerr�_filtersrr�	bus_proxy�HellorE)r!r=r?�hello_reply��	__class__r"r#r$�s

zDBusConnection.__init__NrLcCs4|�||�\}}|r|�||�dS|j�|�dS)z.Serialise and send a :class:`~.Message` objectN)rUr]r=r[)r!rLrOrTrPr"r"r#�send�szDBusConnection.sendr6rMcCs|�t|��S)a+Return the next available message from the connection

        If the data is ready, this will return immediately, even if timeout<=0.
        Otherwise, it will wait for up to timeout seconds, or indefinitely if
        timeout is None. If no message comes in time, it raises TimeoutError.
        )rcr8)r!r7r"r"r#�receive�szDBusConnection.receivecCs:|j|d�}|j�|�|j�|�D]}|j�|�qdS)z\Receive one message and apply filters

        See :meth:`filter`. Returns nothing.
        r6N)r�rz�incomingr{�matches�queue�append)r!r7ra�filterr"r"r#�
recv_messages�s
�zDBusConnection.recv_messages�r7�unwrapc	Cs�t|�t|�}|dur|j}t|j�}|j||d�	|jt|�d�}|jj	�
tjd�}||kr9|r7t
|�S|S|j�|�|j�|�D]}|j�|�qEq)z�Send a message, wait for the reply and return it

        Filters are applied to other messages received before the reply -
        see :meth:`add_filter`.
        N)rOTr6���)rr8ryrQrA�send_messager�r;�header�fields�getr�reply_serialrrzr�r{r�r�r�)	r!rLr7r�r:rO�msg_in�reply_tor�r"r"r#�send_and_get_reply�s"
�z!DBusConnection.send_and_get_replyr)r��bufsizer�cCs |dur	t|d�}t|j||�S)a�Create a filter for incoming messages

        Usage::

            with conn.filter(rule) as matches:
                # matches is a deque containing matched messages
                matching_msg = conn.recv_until_filtered(matches)

        :param jeepney.MatchRule rule: Catch messages matching this rule
        :param collections.deque queue: Matched messages will be added to this
        :param int bufsize: If no deque is passed in, create one with this size
        N)�maxlen)rrr{)r!�ruler�r�r"r"r#r��s
zDBusConnection.filtercCs8t|�}t|�dkr|jt|�d�t|�dks
|��S)aZProcess incoming messages until one is filtered into queue

        Pops the message from queue and returns it, or raises TimeoutError if
        the optional timeout expires. Without a timeout, this is equivalent to::

            while len(queue) == 0:
                conn.recv_messages()
            return queue.popleft()

        In the other I/O modules, there is no need for this, because messages
        are placed in queues by a separate task.

        :param collections.deque queue: A deque connected by :meth:`filter`
        :param float timeout: Maximum time to wait in seconds
        rr6)r8rZr�r;�popleft)r!r�r7r:r"r"r#�recv_until_filtered�s
�z"DBusConnection.recv_until_filteredrur)r1r2r3rWr$r	r�r�r�r�r�rrr�r��
__classcell__r"r"rr#r�s
	
rcs6eZdZdZdd��fdd�
Zdd�Zdd	�Z�ZS)
rajA blocking proxy for calling D-Bus methods

    You can call methods on the proxy object, such as ``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.

    You can set a time limit on a call by passing ``_timeout=`` in the method
    call, or set a default when creating the proxy. The ``_timeout`` argument
    is not passed to the message generator.
    All timeouts are in seconds, and :exc:`TimeoutErrror` is raised if it
    expires before a reply arrives.

    :param msggen: A message generator object
    :param ~blocking.DBusConnection connection: Connection to send and receive messages
    :param float timeout: Default seconds to wait for a reply, or None for no limit
    Nr6cst��|�||_||_dSr)rxr$�_connection�_timeout)r!�msggen�
connectionr7rr"r#r$�s
zProxy.__init__cCs4|jdurdnd|j��}d|j�d|j�|�d�S)N�z
, timeout=zProxy(z, �))r��_msggenr�)r!�extrar"r"r#�__repr__szProxy.__repr__cst�����fdd��}|S)Ncs@|�d�j�}�|i|��}|jjtjusJ��jj||dd�S)Nr�Tr�)�popr�r��message_typer
�method_callr�r�)�args�kwargsr7ra��make_msgr!r"r#�inner	s�z!Proxy._method_call.<locals>.inner)�	functools�wraps)r!r�r�r"r�r#�_method_callszProxy._method_call)r1r2r3rvr$r�r�r�r"r"rr#r�s
rcCs|s
ttt�t���|S)z�Raise ConnectionResetError from an empty read.

    Sometimes the socket raises an error itself, sometimes it gives no data.
    I haven't worked out when it behaves each way.
    )�ConnectionResetErrorr�os�strerror)rbr"r"r#rfsrfF�@rMc
s�tjtjd��t|����fdd�}z)|�j|�t|d�}|D]}|�j|�|�t|�jd���q |�jt	�Wn!tj
yU}z
���td|�d��|�d}~w������
d��S)	z=Create a socket and authenticate ready to send D-Bus messages)�familycs��t���||�Sr)�
settimeoutr;)�methr��r:r=r"r#�with_sock_deadline(sz'prep_socket.<locals>.with_sock_deadline)r?izDid not authenticate in z secondsN)rW�AF_UNIXr8�connectrr[�feedrfrgr
r7rGrhr�)�addrr?r7r��authr�req_data�er"r�r#�prep_socket s&
�
r��SESSION��?cCs$t|�}t|||d�}t||�}|S)aConnect to a D-Bus message bus

    Pass ``enable_fds=True`` to allow sending & receiving file descriptors.
    An error will be raised if the bus does not allow this. For simplicity,
    it's advisable to leave this disabled unless you need it.

    D-Bus has an authentication step before sending or receiving messages.
    This takes < 1 ms in normal operation, but there is a timeout so that client
    code won't get stuck if the server doesn't reply. *auth_timeout* configures
    this timeout in seconds.
    r6)rr�r)�busr?�auth_timeout�bus_addrr=�connr"r"r#r>s
r�__main__zUnique name:)Fr�)r�Fr�)7rvrR�collectionsr�errnorr��	itertoolsrr��	selectorsrrrWr4�typingr�jeepneyrr	r
r�jeepney.authrr
�jeepney.busr�jeepney.fdsrr�jeepney.wrappersrr�jeepney.routingr�jeepney.bus_messagesr�commonrrr�__all__rr8r;r<rrrfr�rr1r��printrEr"r"r"r#�<module>sHCm(�
��

Anon7 - 2022
AnonSec Team