403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.143.247.141
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/xray/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/xray/__pycache__/imunify_manager.cpython-311.pyc
�

���g"��t�ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZdZGd�d��Z
dS)�N)�
find_wp_paths)�advice_list_im360_cache)�filter_by_non_existence�ThirdPartyAdvice�IMUNIFY_PROTECTIONc�r�eZdZdZd�Zed���Zd�Zd�Zd�Z	d�Z
d�Zd	�Zdde
fd�Zde
fd
�Zd�ZdS)�ImunifyManagerz/usr/bin/imunify360-agentc�8�tjd��|_dS)N�imunify_manager)�logging�	getLogger�logger��selfs �K/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/imunify_manager.py�__init__zImunifyManager.__init__s���'�(9�:�:�����c� �t|��S)zX
        Filter by non-exist user or website
        add more filters if needed
        )r)�advice_lists r�_filter_advice_listz"ImunifyManager._filter_advice_lists��'�{�3�3�3rc��	tj|dddd���}tj|j��S#tjtf$r%}|j�d|��Yd}~nld}~wtj	$r%}|j�d|��Yd}~n:d}~wtj
$r%}|j�d|��Yd}~nd}~wwxYwiS)NT�<)�text�capture_output�timeout�checkzUnable to run IM360 command: %sz/Timeout expired while running IM360 command: %sz*Unable to parse json of IM360 response: %s)�
subprocess�run�json�loads�stdout�CalledProcessError�OSErrorr�	exception�TimeoutExpired�JSONDecodeError)r�command�result�es    r�call_im360_commandz!ImunifyManager.call_im360_command$s"��	S��^�G�)-�37�,.�*.�	0�0�0�F�
�:�f�m�,�,�,���-�w�7�	H�	H�	H��K�!�!�"C�Q�G�G�G�G�G�G�G�G������(�	X�	X�	X��K�!�!�"S�UV�W�W�W�W�W�W�W�W������#�	S�	S�	S��K�!�!�"N�PQ�R�R�R�R�R�R�R�R�����	S�����	s-�14�C�
A*�*C�<B�C�.C�Cc�J�tj�|j��S)N)�os�path�exists�imunify360_agentrs r�is_im360_presentzImunifyManager.is_im360_present5s���w�~�~�d�3�4�4�4rc��|���sdS|���}|�dd��S)NT�mu_plugin_installationF)r0�get_im360_settings�get)r�settingss  r�'is_im360_mu_plugin_disabled_server_widez6ImunifyManager.is_im360_mu_plugin_disabled_server_wide8sD���$�$�&�&�	��4��*�*�,�,���<�<� 8�%�@�@�@�@rc�j�|���siS|�|jdddg��S)N�smart-advicezget-options�--json)r0r*r/rs rr3z!ImunifyManager.get_im360_settings?s<���$�$�&�&�	��I��&�&��(=�~�}�^f�'g�h�h�hrc���|���sdS|�|jdd|dg��}|sdS|�dg��}|r|d�dd��SdS)NF�	myimunify�statusr9�itemsr�
protection)r0r*r/r4)r�username�	mi_statusr=s    r�get_im360_protection_statusz*ImunifyManager.get_im360_protection_statusEs����$�$�&�&�	��5��+�+�T�-B�K�QY�[c�em�,n�o�o�	��	��5��
�
�g�r�*�*���	5���8�<�<��e�4�4�4��urc���g}|d}|d}|d}|d}|d}|d}|d}	t|��D]�}
d|
��}tj|�d	|�d	|���d
�������}|	�d|��}
t||||
td||d
ddd|dd���}|�|�������|S)a�
        imunify advice item:
        {"id": 123,
        "server_id": null,
        "type": "malware_found_myimun_2",
        "date": 123,
        "severity": 1,
        "translation_id": "1",
        "parameters": {},
        "description": null,
        "link_text": null,
        "link": null,
        "dashboard": false,
        "popup": false,
        "snoozed_until": 0,
        "popup_title": null,
        "popup_description": null,
        "config_action": {}, "ignore": {},
        "notification": false,
        "smartadvice": true,
        "smartadvice_title": "Web hosting user account is infected",
        "smartadvice_description": "
Imunify detected live malware on the user account hosting this website:

* inf1

* inf2
",
        "smartadvice_user": "isuser",
        "smartadvice_domain": "isuser.com",
        "smartadvice_docroot": "/",
        "ts": 123,
        "first_generated": 123,
        "iaid": "agent-iaid-123",
        "notification_body_html": null,
        "notification_period_limit": 0,
        "notification_subject": null,
        "notification_user": null}
        ->
        {'created_at': '2024-06-22T00:29:23.898986+00:00',
        'updated_at': '2024-06-22T00:29:23.898986+00:00',
        'metadata': {'username': 'tkcpanel', 'domain': 'tk-cpanel.com', 'website': '/'},
        'advice': {'id': 1, 'type': 'IMUNIFY_PROTECTION', 'status': 'review',
        'description': 'Turn on MyImunify Account protection',
        'detailed_description': 'To improve site security, enable the Imunify protection feature.',
        'is_premium': False, 'module_name': 'imunify', 'license_status': 'NOT_REQUIRED',
        'subscription': {'status': 'no',
        'upgrade_url': 'https://whmcs.dev.cloudlinux.com?username=tkcpanel&domain=tk-cpanel.com&server_ip=10.193.176.2
        &m=cloudlinux_advantage&action=provisioning&suite=my_imunify_account_protection'},
        'total_stages': 0, 'completed_stages': 0}}
        �smartadvice_user�smartadvice_domain�smartadvice_docroot�upgrade_url�smartadvice_title�smartadvice_description�iaid�/�-zutf-8�_�reviewF�imunify�NOT_REQUIRED�nor)r?�domain�website�id�typer<�description�detailed_description�
is_premium�module_name�license_status�subscription_statusrF�total_stages�completed_stages)	r�hashlib�md5�encode�	hexdigestr�ADV_TYPE�append�	to_advice)r�imunify_advice�advices_by_docrootr?rQ�infected_docrootrFrUrVrI�siterR�
hashed_udw�adv_id�im360_protection_advices               r�_make_advicezImunifyManager._make_adviceSs?��\ ��!�"4�5��� 4�5��)�*?�@��$�]�3��$�%8�9��-�.G�H���f�%��!�"2�3�3�	K�	K�D� �$�j�j�G� ���%E�%E�6�%E�%E�G�%E�%E�%L�%L�W�%U�%U�V�V�`�`�b�b�J��+�+�z�+�+�F�&6��>D�?F�:@�<D�>F�CN�L`�BG�CL�FT�KO�CN�DE�HI�'K�'K�'K�#�
�%�%�&=�&G�&G�&I�&I�J�J�J�J�!�!rF�returnc	�j�g}|���s|S|r|���S|�|jdddg��}t	jdt
|����|r�|�dg��}|D]u}	|�|��}nG#t$r:}t	j
dt
|��t
|����Yd}~�Xd}~wwxYw|�|���v|�d�|D����}|�
|��|S)Nr8�
notificationsr9zIM360 advice list: %sr=z<Unable to make advice based on item: %s, malformed error: %sc�^�g|]*}|dd�t���(|��+S)�advicerT)�
startswithra)�.0�items  r�
<listcomp>z/ImunifyManager.im360_advice.<locals>.<listcomp>�s7��/x�/x�/x��D�QY�N�[a�Lb�Lm�Lm�nv�Lw�Lw�/x��/x�/x�/xr)r0�_im360_read_advice_cacher*r/r�info�strr4rk�KeyError�error�extendr�_im360_update_advice_cache)r�
cache_only�advicesrr=rs�advice_itemr)s        r�im360_advicezImunifyManager.im360_advice�sd�����$�$�&�&�	��N��	3��0�0�2�2�2��-�-�t�/D�n�Ve�go�.p�q�q����,�c�+�.>�.>�?�?�?��	z��O�O�G�R�0�0�E��
,�
,���"&�"3�"3�D�"9�"9�K�K�������M�"`�"%�d�)�)�"%�a�&�&�*�*�*��H�H�H�H�����	����
���{�+�+�+�+��.�.�/x�/x��/x�/x�/x�y�y�G��'�'��0�0�0��s�B"�"
C&�,0C!�!C&c���g}tj�t��s|S	t	t��5}|�t
j|����}ddd��n#1swxYwYnd#t$r%}|j	�
d|��Yd}~n:d}~wtj$r%}|j	�
d|��Yd}~nd}~wwxYw|S)Nz:An OS error occurred while reading the cache for IM360: %sz*Unable to read IM360 json advice cache: %s)r,r-r.r�openrr�loadr#rr$r&�rrp�fr)s    rruz'ImunifyManager._im360_read_advice_cache�sN�����w�~�~�5�6�6�	��M�	S��-�.�.�
@�!��1�1�$�)�A�,�,�?�?��
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@����	c�	c�	c��K�!�!�"^�`a�b�b�b�b�b�b�b�b������#�	S�	S�	S��K�!�!�"N�PQ�R�R�R�R�R�R�R�R�����	S�����
sF�A>�(A2�&A>�2A6�6A>�9A6�:A>�>
C�B(�(C�:C�Cc�^�	ttd��5}tj||d���ddd��dS#1swxYwYdS#t$r&}|j�d|��Yd}~dSd}~wtj$r&}|j�d|��Yd}~dSd}~wwxYw)N�w�)�indentz;An OS error occurred while updating the cache for IM360: %sz+Unable to write IM360 json advice cache: %s)r�rr�dumpr#rr$r&r�s    rr{z)ImunifyManager._im360_update_advice_cache�s(��	T��-�s�3�3�
/�q��	�&�!�A�.�.�.�.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�
/�
/���	d�	d�	d��K�!�!�"_�ab�c�c�c�c�c�c�c�c�c������#�	T�	T�	T��K�!�!�"O�QR�S�S�S�S�S�S�S�S�S�����	T���sC�A	�<�A	�A�A	�A�A	�	
B,�A4�4B,�B'�'B,N)F)�__name__�
__module__�__qualname__r/r�staticmethodrr*r0r6r3rArk�listrrur{�rrr	r	s�������2��;�;�;��4�4��\�4����"5�5�5�A�A�A�i�i�i����M"�M"�M"�^�������:�$����� T�T�T�T�Trr	)r,rrrr]�clcommon.clwpos_libr�xray.internal.constantsr�xray.adviser.advice_helpersrrrar	r�rr�<module>r�s���
�	�	�	�����������������-�-�-�-�-�-�;�;�;�;�;�;�Q�Q�Q�Q�Q�Q�Q�Q���@T�@T�@T�@T�@T�@T�@T�@T�@T�@Tr

Youez - 2016 - github.com/yon3zu
LinuXploit