̹#]0Y 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) RootEndpointsbind)Scopeatomic_rewrite)LFD)csf)OUTTCPc 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 filerangesz2Successfully removed Acronis ports from csf configz.Failed to remove Arconis ports from csf config)ospathisfiler CSF_CONFIGlogginginfor PORTSRANGEremove_portsr r restart_all Exceptionlogger exception)selfportsr s W/opt/imunify360/venv/lib/python3.11/site-packages/im360/simple_rpc/uninstall_cleanup.pyremove_csf_portsz*UninstallCleanupEndpoints.remove_csf_ports s w~~cn-- LEFFFF O!'E"(FS#====f===/#########LMNNNNN O O OMNNNNNN Os A%B* *$CCzremove-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_LOCALCSF_POST_HOOK_SCRIPT_ETCr is_file read_bytesIPSET_RESTORE_SCRIPTIPSET_RESTORE_SCRIPT_LEGACYreplacer r r r r )r script_pathr contentnew_contentscript_lines r remove_csf_post_hookz.UninstallCleanupEndpoints.remove_csf_post_hook" s) .( K $$D<<>> //++%,3$ L LK #k11&1&9&9+s&K&K'))KK?# #;<<< C / s A