hdZddlmZddlmZmZddlmZddlm Z m Z m Z ddl m Z mZddlmZddlmZdd lmZdd lmZdd lmZeeegGd d e ZGdde ZdS)u  This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.  If not, see . Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see ) MessageType)AVFULL)feature)CommonEndpoints RootEndpointsbind)&MS_CLEAN_REQUIRES_MYIMUNIFY_PROTECTIONcheck_permission)validate_av_plus_license)MalwareCleanupProxy) restore_hits) MalwareHit)MaliciousEndpointStatusceZdZeddded dZeddded dZeddd ed d ZdS) CleanupEndpointsmalware maliciouscleanupFNcKtt|tj||d}|r7|jt j|||d{VdSdSNTuserrhits initiator standard_onlyr r rmalicious_select_sinkprocess_messagerMalwareCleanupTask)selfidsrrrs Z/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/rpc/endpoints/cleanup.pyrzCleanupEndpoints.cleanup+s ?FFF*3T4HHH  *,,.""/           z cleanup-allcKtt|tj|d}|r7|jt j|||d{VdSdSrr)r#rrrs r% cleanup_allzCleanupEndpoints.cleanup_all9s ?FFF*dCCC  *,,.""/           r&restore-originalcKtj||d}t||jd{V\}}t ||SNT)rrestorerrrr r)r#r$rrsuccededfaileds r%restore_originalz!CleanupEndpoints.restore_originalGsW*3T4HHH!-dDJ!?!???????&&x888r&)FNN)__name__ __module__ __qualname__r r rr(r0r&r%rr)s T)[),,   -,  T)[-00   10  T)["45599965999r&rceZdZfdZeddddZeddded dZeddd ed ZxZ S) CleanupRootEndpointscpt|t|_dSr1)super__init__r _proxy)r#sink __class__s r%r:zCleanupRootEndpoints.__init__Ps, )++ r&rrstatuscXK|j}|ddi}nd|d}d|iS)Nr>stoppedrunning)r>progressitems)r; get_progress)r#rBr>s r%cleanup_statusz#CleanupRootEndpoints.cleanup_statusTsC;++--   *FF )x@@F  r&rFcK}tj|d}|rJ|D]Ifd|D}|r5|jt j||d{VHdSdS)NTrc*g|]}|jk |Sr5)r).0hitrs r% z5CleanupRootEndpoints.user_cleanup..ds%EEESCH4D4DS4D4D4Dr&r)rrr r!rr")r#rrusersr user_hitss ` r% user_cleanupz!CleanupRootEndpoints.user_cleanup]s*tDDD    EEEEDEEE *44#6!*&**7    r&r)cKtj|d}t||j|d{V\}}t ||Sr+r-)r#rrr.r/s r%user_restore_originalz*CleanupRootEndpoints.user_restore_originalnsW*dCCC!-dDJ!E!EEEEEEE&&x888r&)F) r2r3r4r:r rEr rMrO __classcell__)r=s@r%r7r7Os,,,,, T)Y))!!*)! T)VY''   ('  T)V/00991099999r&r7N)__doc__"defence360agent.contracts.messagesr,defence360agent.feature_management.constantsrr)defence360agent.feature_management.lookupr defence360agent.rpc_tools.lookuprrr %defence360agent.contracts.permissionsr r "defence360agent.rpc_tools.validater imav.malwarelib.cleanup.cleanerr imav.malwarelib.cleanup.storagerimav.malwarelib.modelrimav.malwarelib.utils.endpointsrrr7r5r&r%r\s~*;:::::AAAAAAAA====== HGGGGG??????888888,,,,,,CCCCCC dV"9"9"9"9"9"9"9"9J$9$9$9$9$9=$9$9$9$9$9r&