̹#] 0YddlZddlZddlmZddlmZddlmZmZddl m Z m Z ddl m Z ddlmZddlmZmZejeZGd d eZdS) N)Path) AcronisBackup) RootEndpointsbind)Scopeatomic_rewrite)LFD)csf)OUTTCPceZdZejZeddZeddZeddZ eddZ d S) UninstallCleanupEndpointszremove-csf-portscKtjtjst jddS tj}tj }tj ttg|Rd|itj d{Vt jddS#t$rtdYdSwxYw)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_CONFIGlogginginforPORTSRANGE remove_portsr r restart_all Exceptionlogger exception)selfportsrs W/opt/imunify360/venv/lib/python3.11/site-packages/im360/simple_rpc/uninstall_cleanup.pyremove_csf_portsz*UninstallCleanupEndpoints.remove_csf_portssw~~cn--  LE F F F F O!'E"(F  S# = = = =f = = =/## # # # # # # # LM N N N N N O O O   M N N N N N N OsA%B**$CCzremove-csf-post-hookcKtjtjfD]}t|}|s& |}|}tjtjfD]}||vr||d}||kr+t d|t||#t$rt d|YwxYwdS)Nz%Removing ipset restore script from %sz-Failed to remove ipset restore script from %s)r CSF_POST_HOOK_SCRIPT_USR_LOCALCSF_POST_HOOK_SCRIPT_ETCris_file read_bytesIPSET_RESTORE_SCRIPTIPSET_RESTORE_SCRIPT_LEGACYreplacerrrrr)r script_pathrcontent new_content script_lines r remove_csf_post_hookz.UninstallCleanupEndpoints.remove_csf_post_hook"s)  .  (   K $$D<<>>  //++% ,3$LLK#k11&1&9&9+s&K&K '))KK?##; <<<     C /  sArEs ::::::@@@@@@@@77777777!!!!!!$$$$$$$$  8 $ $9191919191 9191919191r#