JdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z m Z ddlmZdd lmZdd lmZdd lmZejeZGd 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)DictIterable)FileBasedResourceLimits)resource_limits)"APP_VERSION_DETECTOR_INTENSITY_KEY)ScanFailedErrorceZdZdS)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__7s  rpaths doc_rootsreturnNc Kg}|D]}|d}||p||dzd}|std|td||||r)t |ddng|d t|dt|gd |}tj |jtjtjt$jt$jt$jt( d{V|_dx}} |j| d{V\}} nt#t.$rgt1t25|j|jd{Vdddn #1swxYwYYnwxYw|jjd kr%t;d |j|jj|| dd dS)N/zDomain not found for path: %sz@AVD: path=%s, normalized=%s, domain=%s, doc_roots_keys_sample=%s,idna ) intensity_cpu intensity_iostdoutstderrstdinkey)inputrz$AVD exited with non-zero return code)messagecommand return_codeouterrpathscan_id)decoderstripgetloggerwarningdebuglistkeysappendjoinrrr create_subprocess_cmdr CPUIO subprocessPIPEr r communicaterrProcessLookupErrorkillwait returncoder) rrrdomain_path_pairsr1path_strdomainr)r/r0s rstartzAppVersionDetector.start:s   D{{}}++C00H]]8,, 311F J>III LL, .7?Y^^%%&&rr**R      $ $ vv..!$     ,--*< I1503??/2          c (!Z33%3@@@@@@@@HC ( ( (,-- ( ( !!!joo''''''''' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( : A % %#>  J1  & %s6$F??H09H" H0"H& &H0)H& *H0/H0) rrrr>rrbytesrstrrKrrrrr*sl   D;e_;15c3h; ;;;;;;rr)__doc__loggingrAasynciorbase64rcodecsr contextlibrtypingrr defence360agent.contracts.configr defence360agent.utilsr imav.malwarelib.configr imav.malwarelib.scanr getLoggerrr6rrrrrrZsF*""""""!!!!!!!!DDDDDD111111EEEEEE000000  8 $ $        KKKKKKKKKKr