h dZddlZddlZddlZddlmZmZddlmZddl m Z ddl m Z ddl mZmZddlmZdd lmZdd lmZdd lmZejeZGd d ZdedefdZde fdZdS)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)MalwareMalwareScanIntensity) MessageType)TheSink)resource_limits)MalwareScanResourceTypeRESTORE_ORIGINAL_INTENSITY_KEY) MalwareHit)MDS_PATH)MDSDetachedRestoreDir) hash_pathc,eZdZdddZdefdZdZdS)MalwareDatabaseRestoreN) restore_idc`||_||_|ptjj|_dS)N)app_namepathuuiduuid4hexr)selfrrrs U/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/scan/mds/restore.py__init__zMalwareDatabaseRestore.__init__+s)   $8 (8work_dircdtdt|j|jd|jd|jdt |jd|jdt |jdt tj gS) Nz/opt/ai-bolit/wrapperz --restorez--pathz --app-namez --report-filez --detachedz --progressz --db-timeout) r storage_pathrrstr report_filer progress_filerMDS_DB_TIMEOUT)rrs rcmdzMalwareDatabaseRestore.cmd0sq #   DM 2 2  I  M  $ % %  O  & ' '  & ' '!  rc 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)r rr"log_fileopenerr_fileloggerinforcreate_subprocessrCPUIOrr )rrr"l_fe_fs rrestorezMalwareDatabaseRestore.restoreDs "4? 3 3 x((8$$C"''( h',,#,66 := :C@@@%7"6":!5!8&*H 6                                                          sZ1DC+$A$C C+C C+C C+ D+C/ /D2C/ 3DD D)__name__ __module__ __qualname__rr r"r7rrrr*s[5999999  1    (rrrrcDdt||ztjzS)Nz /var/imunify360/cleanup_storage/) hash_provider)r hashlibsha384rrs rrrXs+ -  xw~111 rsinkcKd|D}|D];}|tj|j|jd{Vz restore_hits.._s7    7 : @ @ @ @ @ @rr@)process_messagerMalwareDatabaseRestoreTask orig_filer)hitsrAdb_hitsrHs r restore_hitsrO^sG  ""  2]S\               r)__doc__r>loggingr defence360agent.contracts.configrr"defence360agent.contracts.messagesr"defence360agent.internals.the_sinkrdefence360agent.utilsrimav.malwarelib.configrr imav.malwarelib.modelr imav.malwarelib.scan.mdsr !imav.malwarelib.scan.mds.detachedr imav.malwarelib.utilsr getLoggerr8r0rrrrOr;rrr\sn* JJJJJJJJ::::::666666111111-,,,,,------CCCCCC++++++  8 $ $++++++++\sc  7       r