403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/secretstorage/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/secretstorage/__pycache__/collection.cpython-311.pyc
�

��b�$��z�dZddlmZmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
mZmZddlmZddlmZmZmZmZmZed	zZed
zZdZdZGd
�d	��Z		ddedededeedef
d�Zdedeefd�Z	ddedeedefd�Z dedefd�Z!dededefd�Z"dedeeefdeefd�Z#dS)arCollection is a place where secret items are stored. Normally, only
the default collection should be used, but this module allows to use any
registered collection. Use :func:`get_default_collection` to get the
default collection (and create it, if necessary).

Collections are usually automatically unlocked when user logs in, but
collections can also be locked and unlocked using
:meth:`Collection.lock` and :meth:`Collection.unlock` methods (unlocking
requires showing the unlocking prompt to user and can be synchronous or
asynchronous). Creating new items and editing existing ones is possible
only in unlocked collection.�)�Dict�Iterator�Optional)�DBusConnection)�	SS_PREFIX�SS_PATH)�Session)�LockedException�ItemNotFoundException�PromptDismissedException)�Item)�DBusAddressWrapper�exec_prompt�
format_secret�open_session�unlock_objects�
Collection�Servicez(/org/freedesktop/secrets/aliases/defaultz+/org/freedesktop/secrets/collection/sessionc
��eZdZdZedfdededeeddfd�Z	de
fd�Zdd	�Zde
fd
�Z
dd�Zdd�Zdeefd
�Zdeeefdeefd�Zdefd�Zdeddfd�Z		ddedeeefdede
dedefd�ZdS)rzRepresents a collection.N�
connection�collection_path�session�returnc��||_||_||_t|t|��|_|j�d��dS)N�Label)rrrr�COLLECTION_IFACE�_collection�get_property)�selfrrrs    �:/usr/lib/python3/dist-packages/secretstorage/collection.py�__init__zCollection.__init__%sQ��%������.���-��-�z�;�;�����%�%�g�.�.�.�.�.�c�P�t|j�d����S)zJReturns :const:`True` if item is locked, otherwise
        :const:`False`.�Locked)�boolrr�rs r �	is_lockedzCollection.is_locked/s#���D�$�1�1�(�;�;�<�<�<r"c�L�|���rtd���dS)zYIf collection is locked, raises
        :exc:`~secretstorage.exceptions.LockedException`.zCollection is locked!N)r'r
r&s r �ensure_not_lockedzCollection.ensure_not_locked4s/���>�>���	;�!�"9�:�:�:�	;�	;r"c�8�t|j|jg��S)aARequests unlocking the collection.

        Returns a boolean representing whether the prompt has been
        dismissed; that means :const:`False` on successful unlocking
        and :const:`True` if it has been dismissed.

        .. versionchanged:: 3.0
           No longer accepts the ``callback`` argument.
        )rrrr&s r �unlockzCollection.unlock:s���d�o��0D�/E�F�F�Fr"c��ttt|j��}|�dd|jg��dS)zLocks the collection.�Lock�aoN)rr�
SERVICE_IFACEr�callr)r�services  r �lockzCollection.lockFs7��$�W�m�T�_�M�M�����V�T�D�$8�#9�:�:�:�:�:r"c���|���|j�dd��\}|dkr)t|j|��\}}|rtd���dSdS)z/Deletes the collection and all items inside it.�Delete��/�Prompt dismissed.N)r)rr0rrr)r�prompt�	dismissed�_results    r �deletezCollection.deleteKsx����� � � ��"�'�'��"�5�5����S�=�=�!,�T�_�f�!E�!E��I�w��
D�.�/B�C�C�C��=�
D�
Dr"c#�~K�|j�d��D]}t|j||j��V�� dS)z3Returns a generator of all items in the collection.�ItemsN)rrr
rr)r�	item_paths  r �
get_all_itemszCollection.get_all_itemsTsS�����)�6�6�w�?�?�	A�	A�I��t��	�4�<�@�@�@�@�@�@�	A�	Ar"�
attributesc#�K�|j�dd|��\}|D]}t|j||j��V�� dS)zdReturns a generator of items with the given attributes.
        `attributes` should be a dictionary.�SearchItems�a{ss}N)rr0r
rr)rr@�resultr>s    r �search_itemszCollection.search_itemsYs`�����"�'�'�
�w�
�K�K����	A�	A�I��t��	�4�<�@�@�@�@�@�@�	A�	Ar"c�h�|j�d��}t|t��sJ�|S)zReturns the collection label.r)rr�
isinstance�str�r�labels  r �	get_labelzCollection.get_label`s3��� �-�-�g�6�6���%��%�%�%�%�%��r"rJc�f�|���|j�dd|��dS)z!Sets collection label to `label`.r�sN)r)r�set_propertyrIs  r �	set_labelzCollection.set_labelfs5����� � � ���%�%�g�s�E�:�:�:�:�:r"F�
text/plain�secret�replace�content_typec�
�|���|jst|j��|_t	|j||��}t
dzd|ft
dzd|fi}|j�dd|||��\}}	t|��dkrt|j||j��St|j|	��\}
}|
rtd���|\}}|d	ksJ�t|j||j��S)
a�Creates a new :class:`~secretstorage.item.Item` with given
        `label` (unicode string), `attributes` (dictionary) and `secret`
        (bytestring). If `replace` is :const:`True`, replaces the existing
        item with the same attributes. If `content_type` is given, also
        sets the content type of the secret (``text/plain`` by default).
        Returns the created item.z
Item.LabelrMzItem.AttributesrC�
CreateItemza{sv}(oayays)b�r7�o)r)rrrrrrr0�lenr
rr)
rrJr@rQrRrS�_secret�
propertiesr>r8r9rD�	signatures
             r �create_itemzCollection.create_itemks��	
��� � � ��|�	9�'���8�8�D�L����f�l�C�C����$�s�E�l��)�)�G�Z�+@�
�
�!�,�1�1������
�
��	�6��y�>�>�A�������D�L�A�A�A�'����@�@��	�6��	@�*�+>�?�?�?�%��	�9��C������D�O�Y���=�=�=r")rN)FrP)�__name__�
__module__�__qualname__�__doc__�DEFAULT_COLLECTIONrrHrr	r!r%r'r)r+r2r;rr
r?rrErKrO�bytesr\�r"r rr"s�������"�"�);�.2�/�/�>�/�"%�/�"�7�+�/�7;�/�/�/�/�=�4�=�=�=�=�
;�;�;�;�
G��
G�
G�
G�
G�;�;�;�;�
D�D�D�D�A�x��~�A�A�A�A�
A�t�C��H�~�A�(�4�.�A�A�A�A��3�����;�s�;�t�;�;�;�;�49�(4�>�>��>�$�s�C�x�.�>�!�>�,0�>�"%�>�9=�>�>�>�>�>�>r"r5NrrJ�aliasrrc�|�|st|��}tdzd|fi}ttt|��}|�dd||��\}}t
|��dkrt|||���St||��\}}	|rtd���|	\}
}|
dksJ�t|||���S)	z�Creates a new :class:`Collection` with the given `label` and `alias`
    and returns it. This action requires prompting.

    :raises: :exc:`~secretstorage.exceptions.PromptDismissedException`
             if the prompt is dismissed.
    zCollection.LabelrM�CreateCollectionza{sv}srV)rr7rW)
rrrrr/r0rXrrr)rrJrdrrZr1rr8r9rDr[s           r �create_collectionrg�s����+��z�*�*���0�0�3��,�?�J� ��-��D�D�G�%�l�l�+=�x�+5�u�>�>��O�V�
�?���a����*�o�w�G�G�G�G�#�J��7�7��I�v��<�&�':�;�;�;�!'��I���������j�/�7�C�C�C�Cr"c#�K�ttt|��}|�d��D]}t	||��V��dS)z1Returns a generator of all available collections.�CollectionsN)rrr/rr)rr1rs   r �get_all_collectionsrj�sW���� ��-��D�D�G�"�/�/�
�>�>�6�6����_�5�5�5�5�5�5�6�6r"c�f�	t|��S#t$rt|dd|��cYSwxYw)zDReturns the default collection. If it doesn't exist,
    creates it.�Default�default)rrrg)rrs  r �get_default_collectionrn�sO��L��*�%�%�%�� �L�L�L� ��Y�	�7�K�K�K�K�K�L���s��0�0c��	t|��S#t$rYnwxYw	t|t��S#t$rYnwxYwtt	|����}|r|dStd���)z�Returns any collection, in the following order of preference:

    - The default collection;
    - The "session" collection (usually temporary);
    - The first collection in the collections list.rzNo collections found.)rr�SESSION_COLLECTION�listrj)r�collectionss  r �get_any_collectionrs�s���
��*�%�%�%�� �
�
�
���
����
��*�&8�9�9�9�� �
�
�
���
�����*�:�6�6�7�7�K��=��1�~��#�$;�<�<�<s��
��7�
A�Ac���ttt|��}|�dd|��\}t	|��dkrtd���t
||��S)z�Returns the collection with the given `alias`. If there is no
    such collection, raises
    :exc:`~secretstorage.exceptions.ItemNotFoundException`.�	ReadAliasrMrVzNo collection with such alias.)rrr/r0rXrr)rrdr1rs    r �get_collection_by_aliasrv�s_��
!��-��D�D�G��|�|�K��e�<�<��O�
�?���q� � �#�$D�E�E�E��j�/�2�2�2r"r@c#�K�ttt|��}|�dd|��\}}||zD]}t	||��V��dS)zsReturns a generator of items in all collections with the given
    attributes. `attributes` should be a dictionary.rBrCN)rrr/r0r
)rr@r1�locked�unlockedr>s      r rErE�sj����!��-��D�D�G��|�|�M�7�J�G�G��F�H��h�&�*�*�	��:�y�)�)�)�)�)�)�*�*r")r5N)N)$r`�typingrrr�jeepney.io.blockingr�secretstorage.definesrr�secretstorage.dhcryptor	�secretstorage.exceptionsr
rr�secretstorage.itemr
�secretstorage.utilrrrrrrr/rarprrHrgrjrnrsrvrErcr"r �<module>r�s���
 �
 �,�+�+�+�+�+�+�+�+�+�.�.�.�.�.�.�4�4�4�4�4�4�4�4�*�*�*�*�*�*�����������#�#�#�#�#�#�-�-�-�-�-�-�-�-�-�-�-�-�-�-��|�+���I�%�
�?��B��h>�h>�h>�h>�h>�h>�h>�h>�VLN�37�D�D�.�D��D�S�D�'��0�D�<F�D�D�D�D�06�N�6�x�
�7K�6�6�6�6�9=�L�L�~�L�$,�W�$5�L�AK�L�L�L�L�=�>�=�j�=�=�=�=�.	3��	3�#&�	3�+5�	3�	3�	3�	3�*�^�*�!�#�s�(�^�*�08���*�*�*�*�*�*r"

Youez - 2016 - github.com/yon3zu
LinuXploit