MɘUdZddlZddlZddlmZddlmZddlm Z m Z ddl m Z m Z ejeZdZdaedzed<d efd Zd efd Zd efd 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 Single-source binary selector for the malware stack (scanner / cleaner / vulnerability patcher). All three on-demand call sites import from here so they cannot disagree by construction. Realtime selection is gated independently in ``aibolit-resident.service``'s ``ExecStart=`` shell (aibolit repo) and defended by a ``rustbolit --resident`` self-check (rustbolit repo) — see DEF-43111. PUBLIC HELPER for unit tests: patch ``imav.malwarelib.engine.use_rustbolit_stack`` or ``engine._is_enabled`` directly. NEVER patch consumer-side imports — single-source patching guarantees scanner / cleaner / patcher all see the same value in one fixture, and avoids the where-to-patch trap. N)ANTIVIRUS_MODE) is_enabled) PROCU2_BINARYRUSTCURATOR_BINARY)AIBOLIT_BINARYRUSTBOLIT_BINARYforce_aibolit_stack_last_logged_statereturncHttd}|tkr)|a|rd}nd}t|t|rdSt jtsdSt jts tsdSdS)zReturn True iff scans/cleans/patches should use the rustbolit stack. A single decision drives scanner, cleaner, and vulnerability patcher. Reads the FF on every call; underlying file read is mtime-cached. F)defaultz@feature flag %r is on; using ai-bolit stack instead of rustbolitz>* + +u GNN- . ..u 4cttrtnt}td||S)zIReturn the chosen scanner binary path and log it for per-spawn forensics.zUsing scanner: %s)rrrrinfochosens r scanner_pathrUs2!4!6!6 J  NF KK#V,,, Mrctr+tjtrtnt }t d||S)uReturn the chosen curator binary path and log it for per-spawn forensics. AV-mode caveat: ``use_rustbolit_stack()`` returns True in AV mode even when rustcurator is absent on disk (the scanner only needs rustbolit). The curator must independently check rustcurator presence and fall back to procu2 when it's missing — otherwise cleanup / patcher subprocesses spawn ENOENT. Restores the pre-DEF-43111 ``os.path.exists(RUSTCURATOR_BINARY)`` fallback. zUsing curator: %s)rrrrrrrrrs r curator_pathr \sS   %'W^^4F%G%G    KK#V,,, Mr)__doc__loggingr defence360agent.contracts.configr'defence360agent.internals.feature_flagsrrimav.malwarelib.cleanuprrimav.malwarelib.scan.ai_bolitrr getLogger__name__rrr bool__annotations__rstrrr rrr-s"""H ;;;;;;MMMMMMEEEEEEEEJJJJJJJJ  8 $ $ #'D4K&&&T:ccr