MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/imunify360/venv/lib/python3.11/site-packages/im360/utils/__pycache__/__init__.cpython-311.pyc
�

fn#g}��:�ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZej
e��ZGd�de��ZGd�de��Zde
ed	ed
e	fd�ZGd�d
e��Zdejejejejffd�Zdd�d�ZdS)�N)�Any�Callable�Type)�LazyLockc��eZdZdS)�	RulesLockN��__name__�
__module__�__qualname__���I/opt/imunify360/venv/lib/python3.11/site-packages/im360/utils/__init__.pyrr��������Drrc��eZdZdS)�
ModSecLockNr	r
rrrrrrr�error�value�returnc������fd�}|S)a.
    Decorator that causes coroutine to return *value* if it raises *error*.

    For example:

       return await return_value_on_error(FileNotFoundError, X)(coro)(*args)

    is equivalent to:

       try:
           return await coro(*args)
       except FileNotFoundError:
           return X
    c�L���tj������fd���}|S)Nc���K�	�|i|���d{V��S#�$r)}t�d|�����cYd}~Sd}~wwxYw)NzReplacing %s from %s with %s)�logger�info)�args�kwargs�e�cororrs   ���r�wrapperz9return_value_on_error.<locals>.decorator.<locals>.wrapper)sz�����
�!�T�4�2�6�2�2�2�2�2�2�2�2�2���
�
�
����:�A�t�U�K�K�K������������
���s�
�A�<�A�A)�	functools�wraps)rrrrs` ��r�	decoratorz(return_value_on_error.<locals>.decorator(sC����	���	�	�	�	�	�	�	�	�
�	�	��rr
)rrr"s`` r�return_value_on_errorr#s*���� 	�	�	�	�	�	��rc���eZdZ�fd�Z�xZS)�PasswordChangeErrorc�V��t���d|�d|����dS)Nz)Password change process exited with code z: )�super�__init__)�self�stderr�
returncode�	__class__s   �rr(zPasswordChangeError.__init__7s<���
�����N�
�N�N�f�N�N�	
�	
�	
�	
�	
r)r
rrr(�
__classcell__)r,s@rr%r%6s8�������
�
�
�
�
�
�
�
�
rr%�c����|t|��kr"td|�dt|�������ttt|����s
Jd���d�|���	d��fd�t|��D�����t�fd�|D����r�S�L)z�
    Return password with *length* char.
    It is guaranteed that password have at least one character from
    each given *required_char_groups*
    z
Given length=zR is too short. Can't get chars from all required groups len(required_char_groups)=zgot empty char group�Tc�8��g|]}tj�����Sr
)�secrets�choice)�.0�_�alphabets  �r�
<listcomp>z,generate_strong_password.<locals>.<listcomp>]s#���L�L�L��G�N�8�4�4�L�L�Lrc3�P��K�|]�t�fd��D����V�� dS)c3� �K�|]}|�vV��	dS)Nr
)r4�c�groups  �r�	<genexpr>z5generate_strong_password.<locals>.<genexpr>.<genexpr>`s'�����-�-�q��U�
�-�-�-�-�-�-rN)�any)r4r;�passwords @�rr<z+generate_strong_password.<locals>.<genexpr>_sR������
�
�27�C�-�-�-�-�H�-�-�-�-�-�
�
�
�
�
�
r)�len�
ValueError�all�map�join�range)�length�required_char_groupsr6r>s  @@r�generate_strong_passwordrG=s������(�)�)�)�)��
,�V�
,�
,��'�(�(�
,�
,�
�
�	
�
��� �	
�	
�����
�����w�w�+�,�,�H�	��7�7�L�L�L�L�e�F�m�m�L�L�L�M�M���
�
�
�
�;O�
�
�
�
�
�	��O�	r)�
passwd_cmdc�h�|�!tjdtj���g}t	|t
��sJ�	t
jg|�|�d�|�	��gdz��dd���dS#tj
$r}t|j|j
���d}~wwxYw)N�passwd)�path�
�T)�input�capture_output�check)�shutil�which�os�defpath�
isinstance�list�
subprocess�runrC�encode�CalledProcessErrorr%r*r+)�username�new_passwordrHrs    r�change_system_passwordr]es������l�8�"�*�=�=�=�>�
��j�$�'�'�'�'�'�:���#�j�#�(�#��*�*�l�1�1�3�3�4�q�8�9�9���		
�	
�	
�	
�	
�	
���(�:�:�:�!�!�(�A�L�9�9�9�����:���s�AB�B1�B,�,B1)�loggingr rSr2rQ�stringrW�typingrrr�defence360agent.utilsr�	getLoggerr
rrr�	Exceptionr#r%�ascii_lowercase�ascii_uppercase�digits�punctuationrGr]r
rr�<module>rhs�����������	�	�	�	�����
�
�
�
�
�
�
�
�����&�&�&�&�&�&�&�&�&�&�*�*�*�*�*�*�	��	�8�	$�	$��	�	�	�	�	��	�	�	�	�	�	�	�	��	�	�	���i����������<
�
�
�
�
�)�
�
�
�������
���	�%�%�%�%�PBF�:�:�:�:�:�:�:r