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/openid/store/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/openid/store/__pycache__/sqlstore.cpython-311.pyc
�

8O�^A���dZddlZddlZddlmZddlmZddlmZd�Z	Gd�de��Z
Gd	�d
e
��ZGd�de
��ZGd
�de
��Z
dS)a.
This module contains C{L{OpenIDStore}} implementations that use
various SQL databases to back them.

Example of how to initialize a store database::

python -c 'from openid.store import sqlstore; import pysqlite2.dbapi2;'
  'sqlstore.SQLiteStore(pysqlite2.dbapi2.connect("cstore.db")).createTables()'
�N)�Association)�OpenIDStore)�noncec����fd�}t�d��r&	�jdd�|_n#t$rYnwxYwt�d��r�j|_|S)Nc�(��|j�|g|�Ri|��S�N)�_callInTransaction)�self�args�kwargs�funcs   ��7/usr/lib/python3/dist-packages/openid/store/sqlstore.py�wrappedz_inTxn.<locals>.wrappeds(���&�t�&�t�T�C�D�C�C�C�F�C�C�C��__name__��__doc__)�hasattrr�	TypeErrorr)r
rs` r�_inTxnrs����D�D�D�D�D��t�Z� � ��	�#�}�Q�R�R�0�G�����	�	�	��D�	�����t�Y���'��,����Ns�-�
:�:c��eZdZdZdZdZdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
ee
��Zd
�Zee��Zdd�Zee��Zd�Zee��Zd�Zee��Zd�Zee��Zd�Zee��ZdS)�SQLStorea�
    This is the parent class for the SQL stores, which contains the
    logic common to all of the SQL stores.

    The table names used are determined by the class variables
    C{L{associations_table}} and
    C{L{nonces_table}}.  To change the name of the tables used, pass
    new table names into the constructor.

    To create the tables with the proper schema, see the
    C{L{createTables}} method.

    This class shouldn't be used directly.  Use one of its subclasses
    instead, as those contain the code necessary to use a specific
    database.

    All methods other than C{L{__init__}} and C{L{createTables}}
    should be considered implementation details.


    @cvar associations_table: This is the default name of the table to
        keep associations in

    @cvar nonces_table: This is the default name of the table to keep
        nonces in.


    @sort: __init__, createTables
    �oid_associations�
oid_noncesNc�L�||_d|_i|_|p|j|p|jd�|_d|_t|jd��r!t|jd��r|j|_t|jd��rt|jd��std���dS)a�
        This creates a new SQLStore instance.  It requires an
        established database connection be given to it, and it allows
        overriding the default table names.


        @param conn: This must be an established connection to a
            database of the correct type for the SQLStore subclass
            you're using.

        @type conn: A python database API compatible connection
            object.


        @param associations_table: This is an optional parameter to
            specify the name of the table used for storing
            associations.  The default value is specified in
            C{L{SQLStore.associations_table}}.

        @type associations_table: C{str}


        @param nonces_table: This is an optional parameter to specify
            the name of the table used for storing nonces.  The
            default value is specified in C{L{SQLStore.nonces_table}}.

        @type nonces_table: C{str}
        N)�associations�noncesi`T�IntegrityError�OperationalErrorzDError using database connection module (Maybe it can't be imported?))
�conn�cur�_statement_cache�associations_table�nonces_table�_table_names�
max_nonce_ager�
exceptions�RuntimeError)r
r r#r$s    r�__init__zSQLStore.__init__Ds���:��	���� "���.�I�$�2I�"�7�d�&7�
�
���)���

�D�I�/�0�0�	(���	�#5�6�6�	(�"�i�D�O����)9�:�:�	@����);�<�<�	@�� ?�@�@�
@�	@�	@rc��|S)zSConvert a blob as returned by the SQL engine into a str object.

        str -> str��r
�blobs  r�
blobDecodezSQLStore.blobDecodevs	���rc��|S)z]Convert a str object into the necessary object for storing
        in the database as a blob.r+�r
�ss  r�
blobEncodezSQLStore.blobEncode|s	���rc��	|j|S#t$r)t||��}||jz}||j|<|cYSwxYwr)r"�KeyError�getattrr%)r
�sql_name�sqls   r�_getSQLzSQLStore._getSQL�sb��	��(��2�2���	�	�	��$��)�)�C��4�$�$�C�.1�D�!�(�+��J�J�J�		���s��0A�Ac��|�|��}d�}tt||����}|j�||��dS)Nc�N�t|t��rt|��S|Sr)�
isinstance�str)�args r�unicode_to_strz)SQLStore._execSQL.<locals>.unicode_to_str�s$���#�s�#�#�
��3�x�x���
r)r8�list�mapr!�execute)r
r6rr7r>�str_argss      r�_execSQLzSQLStore._execSQL�sY���l�l�8�$�$��	�	�	���N�D�1�1�2�2�������h�'�'�'�'�'rc����|dd�dkr&|dd�dz���fd�}t�||��|Std|�d����)N��db_�_sqlc� ���j�g|�R�Sr)rC)rr
r6s ��rr
z"SQLStore.__getattr__.<locals>.func�s���$�t�}�X�5��5�5�5�5rz
Attribute z
 not found)�setattr�AttributeError)r
�attrr
r6s`  @r�__getattr__zSQLStore.__getattr__�sy��������8�u����A�B�B�x�&�(�H�
6�
6�
6�
6�
6�
6�
�D�$��%�%�%��K� �.�T�T�T�!D�E�E�Erc��|j���	|j���|_	||i|��}|j���d|_n%#|j���d|_wxYw	|j���n#|j����xYw|S)z�Execute the given function inside of a transaction, with an
        open cursor. If no exception is raised, the transaction is
        comitted, otherwise it is rolled back.N)r �rollback�cursorr!�close�commit)r
r
rr�rets     rr	zSQLStore._callInTransaction�s���
	
�	������	��y�'�'�)�)�D�H�
 ��d�D�+�F�+�+������ � � ���������� � � ���������

�I��������		��I��� � � ������
s"�B#�A#�!B#�#"B�B#�#B?c�V�|���|���dS)z�
        This method creates the database tables necessary for this
        store to work.  It should not be called if the tables already
        exist.
        N)�db_create_nonce�db_create_assoc�r
s r�txn_createTableszSQLStore.txn_createTables�s.��	
�������������rc��|}|�||j|�|j��|j|j|j��dS)zQSet the association for the server URL.

        Association -> NoneType
        N)�db_set_assoc�handler2�secret�issued�lifetime�
assoc_type)r
�
server_url�association�as    r�txn_storeAssociationzSQLStore.txn_storeAssociation�sO��

�����*�a�h��/�/�!�(�3�3�Q�X�q�z��,�	(�	(�	(�	(�	(rc��|�|�||��n|�|��|j���}t	|��dkrdSg}|D]{}t|��}|�|d��|d<t|�}|jdkr|�	||j
���_|�|j|f���||r"|�
��|ddSdS)z�Get the most recent association that has been set for this
        server URL and handle.

        str -> NoneType or Association
        Nr����)�db_get_assoc�
db_get_assocsr!�fetchall�lenr?r.r�	expiresIn�txn_removeAssociationrZ�appendr\�sort)r
r_rZ�rowsr�values�assocs       r�txn_getAssociationzSQLStore.txn_getAssociation�s�������j�&�1�1�1�1����z�*�*�*��x� � �"�"���t�9�9��>�>��4��L��
?�
?���f���� �O�O�F�1�I�6�6��q�	�#�V�,���?�a�'�'��.�.�z�5�<�H�H�H�H� �'�'���u�(=�>�>�>�>��
��!�!�#�#�#�#�B�'��*�*��trc�N�|�||��|jjdkS)z�Remove the association for the given server URL and handle,
        returning whether the association existed at all.

        (str, str) -> bool
        r)�db_remove_assocr!�rowcount)r
r_rZs   rrkzSQLStore.txn_removeAssociation�s*��	
���Z��0�0�0��x� �1�$�$rc���t|tj��z
��tjkrdS	|�|||��dS#|jj$rYdSwxYw)zmReturn whether this nonce is present, and if it is, then
        remove it from the set.

        str -> boolFT)�abs�timer�SKEW�db_add_noncer'r)r
r_�	timestamp�salts    r�txn_useNoncezSQLStore.txn_useNoncesv��
�y�4�9�;�;�&�'�'�%�*�4�4��5�	����j�)�T�:�:�:��4����-�	�	�	��5�5�	���s�A�A!� A!c��|�ttj����tjz
��|jjSr)�db_clean_nonce�intrwrrxr!rtrVs r�txn_cleanupNonceszSQLStore.txn_cleanupNoncess6�����C��	���,�,�u�z�9�:�:�:��x� � rc��|�ttj������|jjSr)�db_clean_assocrrwr!rtrVs r�txn_cleanupAssociationsz SQLStore.txn_cleanupAssociationss/�����C��	���,�,�-�-�-��x� � r)NNr)r�
__module__�__qualname__rr#r$r)r.r2r8rCrLr	rWr�createTablesrb�storeAssociationrq�getAssociationrk�removeAssociationr|�useNoncer��
cleanupNoncesr��cleanupAssociationsr+rrrr"s���������<,���L�0@�0@�0@�0@�d������
���(�(�(� 
F�
F�
F����,����6�*�+�+�L�(�(�(��v�2�3�3������>�V�.�/�/�N�%�%�%���4�5�5�����"�v�l�#�#�H�!�!�!��F�,�-�-�M�!�!�!�!�&�!8�9�9���rrc�P��eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
d�Z�fd
�Z�xZS)�SQLiteStorez�
    This is an SQLite-based specialization of C{L{SQLStore}}.

    To create an instance, see C{L{SQLStore.__init__}}.  To create the
    tables it will use, see C{L{SQLStore.createTables}}.

    All other methods are implementation details.
    z�
    CREATE TABLE %(nonces)s (
        server_url VARCHAR,
        timestamp INTEGER,
        salt CHAR(40),
        UNIQUE(server_url, timestamp, salt)
    );
    a
    CREATE TABLE %(associations)s
    (
        server_url VARCHAR(2047),
        handle VARCHAR(255),
        secret BLOB(128),
        issued INTEGER,
        lifetime INTEGER,
        assoc_type VARCHAR(64),
        PRIMARY KEY (server_url, handle)
    );
    z}INSERT OR REPLACE INTO %(associations)s (server_url, handle, secret, issued, lifetime, assoc_type) VALUES (?, ?, ?, ?, ?, ?);z_SELECT handle, secret, issued, lifetime, assoc_type FROM %(associations)s WHERE server_url = ?;znSELECT handle, secret, issued, lifetime, assoc_type FROM %(associations)s WHERE server_url = ? AND handle = ?;zDSELECT server_url FROM %(associations)s WHERE issued + lifetime < ?;zADELETE FROM %(associations)s WHERE server_url = ? AND handle = ?;z9DELETE FROM %(associations)s WHERE issued + lifetime < ?;z(INSERT INTO %(nonces)s VALUES (?, ?, ?);z+DELETE FROM %(nonces)s WHERE timestamp < ?;c� �t|��Sr)�
memoryviewr0s  rr2zSQLiteStore.blobEncodeXs���!�}�}�rc����	tt|��j|i|��S#|jj$r.}tjdt|����rYd}~dS�d}~wwxYw)Nz^columns .* are not unique$F)�superr�r�r'r�re�matchr<)r
rr�why�	__class__s    �rr�zSQLiteStore.useNonce[sy���	�4�5��d�+�+�4�d�E�f�E�E�E����/�	�	�	��x�5�s�3�x�x�@�@�
��u�u�u�u�u������		���s�#�A �"A�A�A )rr�r�r�create_nonce_sql�create_assoc_sql�
set_assoc_sql�get_assocs_sql�
get_assoc_sql�get_expired_sql�remove_assoc_sql�clean_assoc_sql�
add_nonce_sql�clean_nonce_sqlr2r��
__classcell__)r�s@rr�r�"s��������������2�M�D�N�	E��L�O�?��R�O�>�M�C�O����
�
�
�
�
�
�
�
�
rr�c�`�eZdZdZ	ddlZn
#e$rdZYnwxYwdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdS)�
MySQLStorea&
    This is a MySQL-based specialization of C{L{SQLStore}}.

    Uses InnoDB tables for transaction support.

    To create an instance, see C{L{SQLStore.__init__}}.  To create the
    tables it will use, see C{L{SQLStore.createTables}}.

    All other methods are implementation details.
    rNz�
    CREATE TABLE %(nonces)s (
        server_url BLOB NOT NULL,
        timestamp INTEGER NOT NULL,
        salt CHAR(40) NOT NULL,
        PRIMARY KEY (server_url(255), timestamp, salt)
    )
    ENGINE=InnoDB;
    aG
    CREATE TABLE %(associations)s
    (
        server_url BLOB NOT NULL,
        handle VARCHAR(255) NOT NULL,
        secret BLOB NOT NULL,
        issued INTEGER NOT NULL,
        lifetime INTEGER NOT NULL,
        assoc_type VARCHAR(64) NOT NULL,
        PRIMARY KEY (server_url(255), handle)
    )
    ENGINE=InnoDB;
    zDREPLACE INTO %(associations)s VALUES (%%s, %%s, %%s, %%s, %%s, %%s);�aSELECT handle, secret, issued, lifetime, assoc_type FROM %(associations)s WHERE server_url = %%s;�FSELECT server_url FROM %(associations)s WHERE issued + lifetime < %%s;�rSELECT handle, secret, issued, lifetime, assoc_type FROM %(associations)s WHERE server_url = %%s AND handle = %%s;�EDELETE FROM %(associations)s WHERE server_url = %%s AND handle = %%s;�;DELETE FROM %(associations)s WHERE issued + lifetime < %%s;�.INSERT INTO %(nonces)s VALUES (%%s, %%s, %%s);�-DELETE FROM %(nonces)s WHERE timestamp < %%s;)rr�r�r�MySQLdbr'�ImportErrorr�r�r�r�r�r�r�r�r�r�r+rrr�r�hs�������	�	��$�$�$�$�$�������
�
�
���������>�M�G�N�N�O�	J��C��T�O�D�M�E�O�O�Os�
��r�c��eZdZdZ	ddlZn%#e$rddlmZe���YnwxYwdZ	dZ
dZd�ZdZ
d	Zd
ZdZdZd
ZdZdZdZd�Zd�ZdS)�PostgreSQLStorez�
    This is a PostgreSQL-based specialization of C{L{SQLStore}}.

    To create an instance, see C{L{SQLStore.__init__}}.  To create the
    tables it will use, see C{L{SQLStore.createTables}}.

    All other methods are implementation details.
    rN)�compatz�
    CREATE TABLE %(nonces)s (
        server_url VARCHAR(2047) NOT NULL,
        timestamp INTEGER NOT NULL,
        salt CHAR(40) NOT NULL,
        PRIMARY KEY (server_url, timestamp, salt)
    );
    a�
    CREATE TABLE %(associations)s
    (
        server_url VARCHAR(2047) NOT NULL,
        handle VARCHAR(255) NOT NULL,
        secret BYTEA NOT NULL,
        issued INTEGER NOT NULL,
        lifetime INTEGER NOT NULL,
        assoc_type VARCHAR(64) NOT NULL,
        PRIMARY KEY (server_url, handle),
        CONSTRAINT secret_length_constraint CHECK (LENGTH(secret) <= 128)
    );
    c���|�||��}|j���}t|��r|�||||||��S|�||||||��S)z�
        Set an association.  This is implemented as a method because
        REPLACE INTO is not supported by PostgreSQL (and is not
        standard SQL).
        )rfr!rhri�db_update_assoc�db_new_assoc)	r
r_rZr[r\r]r^�resultrns	         rrYzPostgreSQLStore.db_set_assoc�s����"�"�:�v�6�6���x� � �"�"���t�9�9�	;��'�'����*�(2�F�<�<�
<�
�$�$�Z����%-�z�;�;�
;rzCINSERT INTO %(associations)s VALUES (%%s, %%s, %%s, %%s, %%s, %%s);z�UPDATE %(associations)s SET secret = %%s, issued = %%s, lifetime = %%s, assoc_type = %%s WHERE server_url = %%s AND handle = %%s;r�r�r�r�r�r�r�c�$�ddlm}||��S)Nr)�Binary)�psycopg2r�)r
r-r�s   rr2zPostgreSQLStore.blobEncode�s"��#�#�#�#�#�#��v�d�|�|�rc�*�|���Sr)�tobytesr,s  rr.zPostgreSQLStore.blobDecode�s���|�|�~�~�r)rr�r�rr�r��psycopg2cffir��registerr'r�r�rY�
new_assoc_sql�update_assoc_sqlr�r�r�r�r�r�r�r2r.r+rrr�r��s��������������������'�'�'�'�'�'��������������J�����;�;�;�&>�M�C��G�N�N�O�	J��C��T�O�D�M�E�O����
����s�
�/�/r�)rr�rw�openid.associationr�openid.store.interfacer�openid.storerrrr�r�r�r+rr�<module>r�s?����
�	�	�	�����*�*�*�*�*�*�.�.�.�.�.�.�������
�
�
� }:�}:�}:�}:�}:�{�}:�}:�}:�@C�C�C�C�C�(�C�C�C�L:F�:F�:F�:F�:F��:F�:F�:F�zY�Y�Y�Y�Y�h�Y�Y�Y�Y�Yr

Youez - 2016 - github.com/yon3zu
LinuXploit