403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.137.184.32
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/cloudlinux/venv/lib/python3.11/site-packages/clwpos/user/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/user/__pycache__/redis_lib.cpython-311.pyc
�

��g{���ddlmZddlZddlmZmZmZddlmZ	ddl
mZmZddl
mZGd�de��ZGd	�d
e��ZGd�de��ZdS)
�)�absolute_importN)�Optional�Tuple�Dict)�gettext)�ExternalProgramFailed�run_command)�	WposErrorc�"��eZdZdZ�fd�Z�xZS)�DeadRedisPurgeAttemptzW
    Happens when somebody tries to purge
    redis instance which is not runnning
    c�f��t���td�����dS)Nz�Unable to purge cache because cache database is not running. Enable at least one optimization feature to start cache database instance.)�message��super�__init__�_)�self�	__class__s ��L/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwpos/user/redis_lib.pyrzDeadRedisPurgeAttempt.__init__sE���
������
Y�"Z�"Z��	[�	[�	[�	[�	[�)�__name__�
__module__�__qualname__�__doc__r�
__classcell__�rs@rrrsK���������
[�[�[�[�[�[�[�[�[rrc�,��eZdZdZdedef�fd�Z�xZS)�PurgeFailedErrorzN
    Happens when redis is not able to purge cached data for some reason.
    �std_out�std_errc�z��t���td��dd|pd|pdd����dS)Nz�Unable to purge cache. 
Database backend returned error of command "%(command)s" execution. Try again a bit later or contact your system administrator for help.z6stdout: 
<i>%(stdout)s</i>
stderr: 
<i>%(stderr)s</i>
�purge�empty)�command�stdout�stderr)r�details�contextr)rrr rs   �rrzPurgeFailedError.__init__#sg���
������]�^�^�4�#�!�,�W�!�,�W���	�	�	�	�	�	r)rrrr�strrrrs@rrrsU������������c����������rrc��eZdZ	ddededdfd�Zd�Zdedeeeeffd	�Zde	fd
�Z
defd�Zdefd�Z
deefd
�ZdS)�RedisLibUser�/opt/alt/redis/bin/redis-cli�socket_path�redis_cli_path�returnNc�"�||_||_dS)N)r-r.)rr-r.s   rrzRedisLibUser.__init__4s��&���,����rc�L�|jd|jg|�d��zS)Nz-s� )r.r-�split)r�
redis_commands  r�get_redis_shell_commandz$RedisLibUser.get_redis_shell_command9s3�������
�
����$�$�	%�	%rr$c�"�|�|��}	t|d���\}}}n_#tjtf$rF}tt
d��d�|��t|��d�����d}~wwxYw|||fS)NT)�return_full_outputz6Error during %(command)s command execution: 
%(error)sr2)r$�error)rr()	r5r	�
subprocess�CalledProcessErrorrr
r�joinr))rr$r4�
returncoderr r8s       r�run_redis_commandzRedisLibUser.run_redis_command@s����4�4�W�=�=�
�	�+6��$�,�,�,�(�J������-�/D�E�	�	�	���S�T�T�$'�H�H�]�$;�$;�c�%�j�j�Q�Q����
�����	����
�7�G�+�+s�-�B	�AB�B	c��|���st���d}|�|��\}}}|dksd|���vrt	||���d|���iS)z4
        Clean entire redis cache for user.
        zflushall asyncr�ok�used_memory)�is_redis_aliverr=�lowerr�get_redis_used_memory)r�
purge_commandr<rr s     r�purge_rediszRedisLibUser.purge_redisMs����"�"�$�$�	*�'�)�)�)�(�
�'+�'=�'=�m�'L�'L�$�
�G�W���?�?�d�'�-�-�/�/�9�9�"�7�G�4�4�4�
�4�5�5�7�7�
�	
rc�l�|�d��\}}}|dkod|���vS)z1
        Check if user's redis is alive.
        �pingr�pong)r=rB�rr<rrs    rrAzRedisLibUser.is_redis_alive^s:��"&�!7�!7��!?�!?��
�G�Q��Q��<�6�W�]�]�_�_�#<�<rc��|�d��\}}}|dko7t|����d����dkS)z�
        Check if user's redis is empty.
        Example (redis is empty):
            # Keyspace
        Example (redis is NOT empty):
            # Keyspace
            db0:keys=2,expires=0,avg_ttl=0
        z
info keyspacer�
�)r=�len�stripr3rIs    r�is_redis_emptyzRedisLibUser.is_redis_emptyesP��"&�!7�!7��!H�!H��
�G�Q��Q��H�3�w�}�}���'<�'<�T�'B�'B�#C�#C�q�#H�Hrc���|�d��\}}}|�d��D];}|�d��s�|�d��\}}|dkr|ndcSdS)aL
        Return amount of memmory used by user's redis instance
        in human readable format (kb or mb).
        If redis status is offline, 'used_memory_value' value is null.
        'info memory' command output:
            # Memory
            used_memory:369616
            used_memory_human:360.95K
            ...
        zinfo memoryrK�used_memory_human�:�nullN)r=r3�
startswith)rrr�line�used_memory_values     rrCz"RedisLibUser.get_redis_used_memoryqs����.�.�}�=�=�
��7�A��M�M�$�'�'�	N�	N�D��?�?�#6�7�7�
��#'�:�:�c�?�?� �A� �(9�V�(C�(C�$�$��M�M�M�		N�	Nr)r,)rrrr)rr5r�intr=rrE�boolrArOrrC�rrr+r+2s������(F�-�-�C�-�!$�-�JN�-�-�-�-�
%�%�%�,��,��s�C��}�1E�,�,�,�,�
�T�
�
�
�
�"=��=�=�=�=�
I��
I�
I�
I�
I�N�x��}�N�N�N�N�N�Nrr+)�
__future__rr9�typingrrr�clwposrr�clcommon.utilsrr	�clwpos.cl_wpos_exceptionsr
rr�objectr+rYrr�<module>r`s#��'�&�&�&�&�&�����(�(�(�(�(�(�(�(�(�(�������=�=�=�=�=�=�=�=�/�/�/�/�/�/�	[�	[�	[�	[�	[�I�	[�	[�	[������y����(ON�ON�ON�ON�ON�6�ON�ON�ON�ON�ONr

Youez - 2016 - github.com/yon3zu
LinuXploit