/opt/imunify360/venv/lib/python3.11/site-packages/im360/simple_rpc/__pycache__
� ̹#]0�Y� � � d dl Z d dlZd dlmZ d dlmZ d dlmZmZ d dl m Z mZ d dlm Z d dlmZ d dlmZmZ e j e� � Z G d � d e� � ZdS )� N)�Path)� AcronisBackup)� RootEndpoints�bind)�Scope�atomic_rewrite)�LFD)�csf)�OUT�TCPc � � e Zd Zej Z ed� � d� � � Z ed� � d� � � Z ed� � d� � � Z ed� � d� � � Z d S ) �UninstallCleanupEndpointszremove-csf-portsc � � K � t j � t j � � st j d� � d S t j }t j }t j t t g|�R d|i� t j � � � d {V �� t j d� � d S # t $ r t � d� � Y d S w xY w)Nz*Nothing to do, there is no csf config file�rangesz2Successfully removed Acronis ports from csf configz.Failed to remove Arconis ports from csf config)�os�path�isfiler � CSF_CONFIG�logging�infor �PORTS�RANGE�remove_portsr r �restart_all� Exception�logger� exception)�self�portsr s �W/opt/imunify360/venv/lib/python3.11/site-packages/im360/simple_rpc/uninstall_cleanup.py�remove_csf_portsz*UninstallCleanupEndpoints.remove_csf_ports s� � � � ��w�~�~�c�n�-�-� ��L�E�F�F�F��F� O�!�'�E�"�(�F���S�#�=��=�=�=�f�=�=�=��/�#�#�#�#�#�#�#�#�#��L�M�N�N�N�N�N��� O� O� O����M�N�N�N�N�N�N� O���s �A%B* �*$C�Czremove-csf-post-hookc � �� K � t j t j fD ]�}t |� � }|� � � s�& |� � � }|}t j t j fD ]}||v r|� |d� � }�||k r+t � d|� � t ||� � ��# t $ r t � d|� � Y ��w xY wd S )N� z%Removing ipset restore script from %sz-Failed to remove ipset restore script from %s)r �CSF_POST_HOOK_SCRIPT_USR_LOCAL�CSF_POST_HOOK_SCRIPT_ETCr �is_file� read_bytes�IPSET_RESTORE_SCRIPT�IPSET_RESTORE_SCRIPT_LEGACY�replacer r r r r )r �script_pathr �content�new_content�script_lines r �remove_csf_post_hookz.UninstallCleanupEndpoints.remove_csf_post_hook"