hodZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z mZddlmZdd lmZdd lmZdd lmZdd lmZeeZGd de e 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 N) defaultdict) getLogger)Malware) MessageType) MessageSink MessageSourceexpect)MalwareScanType)MalwareIgnorePath)DetachedScanPlugin)MalwareScanner)recurring_checkceZdZd\ZZdZdZdZdZdZ dZ e e j dZe e jdZed Zd Zd Zeejd ZdS) Scanner)NNNcK||_||_|j||_dSN)_loop_sink create_task_recurring_scan _scan_task)selfloopsinks T/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/plugins/scanner.py create_sourcezScanner.create_source/s;  *001E1E1G1GHHc<Ktt|_dSr)rset_targets)rrs r create_sinkzScanner.create_sink5s#C(( rcVK|j|jd{VdSr)rcancelrs rshutdownzScanner.shutdown8s:    orc l|dD]}t|tsSt|}tj|}t d||tt||dtj }|j | |dS)Nfilelistz1Received path %s as %s instead of %s. Message: %s scan_type) isinstancestrtypeosfsdecodeloggererrorgetr REALTIMEr add)rmessagepathtr(s r_process_scan_taskzScanner._process_scan_task<sJ' / /DdC(( JJ{4(( GII  K1IJJI M) $ ( ( . . . . / /rc4K||dSr)r6)rr3s rprocess_scan_taskzScanner.process_scan_taskKs  (((((rcK|d}tj||dd}||dS)Nfilesr+rescan)r'r()rMalwareScanTaskr0r6)rr3r'msgs r rescan_fileszScanner.rescan_filesOsV7#)VX)F)F    $$$$$rcKt}|D]P}tj|r/t j|d{Vs||Q|Sr)listr,r4existsr is_path_ignoredappend)targetsresultfilenames r _filter_outzScanner._filter_outWsx ( (Hw~~ (-=hGGGGGGGG ( h''' rcK|r-td|||d{V}|sdStd|t |jd}||||d{V}|Ktj |d{V}|j tj di|d{VdSdS)Nz#Checking files to scan with type={}zScanning files: %sT)rhooks)r()r.infoformatrGdebugr rstart async_waitr aggregate_resultprocess_messager MalwareScan)rrDr( file_listscannerrEr3s r _scan_targetszScanner._scan_targetsasQ   KK5<K|d{VdSr)rXr$s rrzScanner._recurring_scan|s,jjllr)__name__ __module__ __qualname__rrr rrr!r%r6r rr<r8MalwareRescanFilesr> staticmethodrGrUrXrConfigINOTIFY_SCAN_PERIODrrJrrrr*sLE5HJIII ))) / / / VK '(()))() VK *++%%,+%\*777 _V/0010rr)__doc__r, collectionsrloggingr defence360agent.contracts.configrr_"defence360agent.contracts.messagesr!defence360agent.contracts.pluginsrrr imav.malwarelib.configr imav.malwarelib.modelr %imav.malwarelib.plugins.detached_scanr imav.malwarelib.scan.scannerr defence360agent.utilsrrZr.rrJrrrls?* ######>>>>>>:::::: 322222333333DDDDDD777777111111 8  TTTTTk=TTTTTr