]_"dZddlZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZddlmZdd lmZmZdd lmZdd lmZdd lmZdd lmZejeZGddZde de fdZ! dde"ede dedzfdZ#dS)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 N)cast)MalwareMalwareScanIntensity)TheSink)resource_limits)MalwareDatabaseRestoreTask)CleanupRevertInitiator)RESTORE_ORIGINAL_INTENSITY_KEYMalwareScanResourceType) MalwareHit)MDS_PATH)MDSDetachedRestoreDir) hash_pathc LeZdZddddedededzdedzfdZdefd Zd ZdS) MalwareDatabaseRestoreN) signature_id restore_idapp_namepathrrcn||_||_||_|ptjj|_dSN)rrruuiduuid4hexr)selfrrrrs U/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/scan/mds/restore.py__init__zMalwareDatabaseRestore.__init__-s3!  ($8 (8work_dirc*dtd|jd|jdt|jd|jdt|jdttjg}|j r |d|j gz }n|d t|j|jgz }|S) Nz/opt/ai-bolit/wrapperz--pathz --app-namez --report-filez --detachedz --progressz --db-timeoutz--restore-sig-idz --restore) r rrstr report_filer progress_filerMDS_DB_TIMEOUTr storage_path)rrcommands rcmdzMalwareDatabaseRestore.cmd:s #   I  M  $ % %  O  & ' '  & ' ' "   M *D,=> >GG  \$)T]%K%KL LGrc Kt|j5}||}|jd5}|jd5}t d|tj |tj tj d||t|td{Vdddn #1swxYwYdddn #1swxYwYddddS#1swxYwYdS)Nw)modezRunning MDS Restore with: %sT) intensity_cpu intensity_iostart_new_sessionstdoutstderrcwdkey)rrr'log_fileopenerr_fileloggerinforcreate_subprocessrCPUIOr!r )rrr'l_fe_fs rrestorezMalwareDatabaseRestore.restoreRs "4? 3 3 x((8$$C!&&C&00 47!&&C&00 47 :C@@@%7"6":!5!8&*H 6                                                           sZ1DC+$A$C C+C C+C C+ D+C/ /D2C/ 3DD D)__name__ __module__ __qualname__r!rrr'r<rrrr,s $(!% 9 9 9 9 9 Dj 9 $J 9 9 9 910rrrrcDdt||ztjzS)Nz /var/imunify360/cleanup_storage/) hash_provider)rhashlibsha384)rrs rr%r%gs+ -  xw~111 rhitssink initiatorc Kd|D}|D]t}|ttt|jtt|j|t jkr|jndd{VudS)NcFg|]}|jtjjk|Sr@) resource_typer DBvalue).0hits r z restore_hits..rs7    7 : @ @ @ @ @ @r)rrr) process_messagerrr! orig_filerr IMUNIFYr)rErFrGdb_hitsrNs r restore_hitsrTms G   "" &#s}--c3<00 6 >>>!--                 rr)$__doc__rCloggingrtypingr defence360agent.contracts.configrr"defence360agent.internals.the_sinkrdefence360agent.utilsrimav.contracts.messagesrimav.malwarelib.cleanup.typesr imav.malwarelib.configr r imav.malwarelib.modelr imav.malwarelib.scan.mdsr !imav.malwarelib.scan.mds.detachedrimav.malwarelib.utilsr getLoggerr=r5rr!r%listrTr@rrrds* JJJJJJJJ666666111111>>>>>>@@@@@@-,,,,,------CCCCCC++++++  8 $ $88888888vsc04  z   &,      r