h dZddlZddlmZddlmZddlmZddlm Z ddl m Z m Z ddl mZdd lmZdd lmZdd lmZGd d eZGddZdS)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)CancelledError) b64encode)encode)suppress)DictIterator)FileBasedResourceLimits)"APP_VERSION_DETECTOR_INTENSITY_KEY)ScanFailedError)resource_limitsceZdZdS)AVDExecutionErrorN)__name__ __module__ __qualname__^/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/scan/app_version_detector.pyrr#sDrrcLeZdZgdZdZdeedeeefddfdZ dS)AppVersionDetector)z9/opt/app-version-detector/app-version-detector-wrapper.shzW--sqlite-db-report=/var/lib/cloudlinux-app-version-detector/components_versions.sqlite3z --stdin-dirsz--paths-in-base64z--scan-depth=3cd|_dS)N)_proc)selfs r__init__zAppVersionDetector.__init__4s  rpaths doc_rootsreturnNc Kg}|D]m}|dt||ddt |gnd|}t j|jtj tj tj tj tj td{V|_dx}} |j|d{V\}}nt#t"$rgt%t&5|j|jd{Vdddn #1swxYwYYnwxYw|jjdkr%t/d|j|jj||dd dS) N,idna ) intensity_cpu intensity_iostdoutstderrstdinkey)inputrz$AVD exited with non-zero return code)messagecommand return_codeouterrpathscan_id)appendjoinrgetdecoderr create_subprocess_cmdr CPUIO subprocessPIPEr r communicaterrProcessLookupErrorkillwait returncoder)rrrdomain_path_pairsr/r'r-r.s rstartzAppVersionDetector.start7s/   D  $ $ y}}T[[]]B??HH!$     ,--*< I1503??/2          c (!Z33%3@@@@@@@@HC ( ( (,-- ( ( !!!joo''''''''' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( : A % %#>  J1  & %s61$DF49E9- F9E= =FE= FF) rrrr6rrbytesrstrrArrrrr'sl   D+e_+15c3h+ ++++++rr)__doc__r9asynciorbase64rcodecsr contextlibrtypingrr defence360agent.contracts.configr imav.malwarelib.configr imav.malwarelib.scanr defence360agent.utilsr rrrrrrNs!*""""""!!!!!!!!DDDDDDEEEEEE000000111111        ;;;;;;;;;;r