403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.216.237.210
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python38/lib64/python3.8/site-packages/playhouse/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python38/lib64/python3.8/site-packages/playhouse/__pycache__/sqlcipher_ext.cpython-38.pyc
U

S��W~�@s�dZddlZddlZddlTddlmZzddlmZWnBe	k
rzzddl
mZWne	k
rte	d��YnXYnXe�eje
�e�eje
�e�eje
�Gdd�de�ZGd	d
�d
ee�ZGdd�dee�ZdS)
a�
Peewee integration with pysqlcipher.

Project page: https://github.com/leapcode/pysqlcipher/

**WARNING!!! EXPERIMENTAL!!!**

* Although this extention's code is short, it has not been propery
  peer-reviewed yet and may have introduced vulnerabilities.
* The code contains minimum values for `passphrase` length and
  `kdf_iter`, as well as a default value for the later.
  **Do not** regard these numbers as advice. Consult the docs at
  http://sqlcipher.net/sqlcipher-api/ and security experts.

Also note that this code relies on pysqlcipher and sqlcipher, and
the code there might have vulnerabilities as well, but since these
are widely used crypto modules, we can expect "short zero days" there.

Example usage:

     from peewee.playground.ciphersql_ext import SqlCipherDatabase
     db = SqlCipherDatabase('/path/to/my.db', passphrase="don'tuseme4real",
                            kdf_iter=1000000)

* `passphrase`: should be "long enough".
  Note that *length beats vocabulary* (much exponential), and even
  a lowercase-only passphrase like easytorememberyethardforotherstoguess
  packs more noise than 8 random printable chatacters and *can* be memorized.
* `kdf_iter`: Should be "as much as the weakest target machine can afford".

When opening an existing database, passphrase and kdf_iter should be identical
to the ones used when creating it.  If they're wrong, an exception will only be
raised **when you access the database**.

If you need to ask for an interactive passphrase, here's example code you can
put after the `db = ...` line:

    try:  # Just access the database so that it checks the encryption.
        db.get_tables()
    # We're looking for a DatabaseError with a specific error message.
    except peewee.DatabaseError as e:
        # Check whether the message *means* "passphrase is wrong"
        if e.args[0] == 'file is encrypted or is not a database':
            raise Exception('Developer should Prompt user for passphrase '
                            'again.')
        else:
            # A different DatabaseError. Raise it.
            raise e

See a more elaborate example with this code at
https://gist.github.com/thedod/11048875
�N)�*)�SqliteExtDatabase)�dbapi2z$Sqlcipher python bindings not found.c@seZdZdd�ZdS)�_SqlCipherDatabasecKs�|�dd�}|�dd�}t|�dkr,td��|r@|dkr@td��tj|f|�}|�|�|�d	�|�d
d���|�d�|��|S)
N�
passphrase��kdf_iteri��zESqlCipherDatabase passphrase should be at least eight character long.i'z4SqlCipherDatabase kdf_iter should be at least 10000.zPRAGMA key='{0}'�'z''zPRAGMA kdf_iter={0:d})	�pop�len�ImproperlyConfigured�	sqlcipher�connect�_add_conn_hooks�execute�format�replace)�self�database�kwargsrr�conn�r�J/opt/alt/python38/lib64/python3.8/site-packages/playhouse/sqlcipher_ext.py�_connectHs"��
�z_SqlCipherDatabase._connectN)�__name__�
__module__�__qualname__rrrrrrGsrc@seZdZdS)�SqlCipherDatabaseN)rrrrrrrr]srcs(eZdZ�fdd�Z�fdd�Z�ZS)�SqlCipherExtDatabasecsd|d<tt|�j||�dS)NFZc_extensions)�superr�__init__)r�argsr��	__class__rrr!bszSqlCipherExtDatabase.__init__cshtt|�j||�}|�|�|�|�|�|�|jr>|j|_|jrd|�	d�|jD]}|�
|�qT|S)NT)r rrZ_load_aggregatesZ_load_collationsZ_load_functionsZ_row_factory�row_factoryZ_extensions�enable_load_extension�load_extension)rr"rr�	extensionr#rrrfs




zSqlCipherExtDatabase._connect)rrrr!r�
__classcell__rrr#rrasr)�__doc__�datetime�decimal�peeweeZplayhouse.sqlite_extrZpysqlcipherrr�ImportErrorZpysqlcipher3�register_adapter�Decimal�str�date�time�objectr�SqliteDatabaserrrrrr�<module>s"4

Youez - 2016 - github.com/yon3zu
LinuXploit