X7ROOT File Manager
Current Path:
/opt/imunify360/venv/lib/python3.11/site-packages/imav/plugins
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
site-packages
/
imav
/
plugins
/
??
..
??
__init__.py
(0 B)
??
__pycache__
??
aibolit_resident_ff_watcher.py
(10.06 KB)
??
check_license.py
(9.27 KB)
??
conflicts.py
(3.18 KB)
??
detect_admin_tools_watcher.py
(2.64 KB)
??
event_hook_executor.py
(3.72 KB)
??
event_hooks.py
(3.47 KB)
??
generic_sensor.py
(5.82 KB)
??
im360_register.py
(2.82 KB)
??
imunify_patch_id.py
(2.33 KB)
??
inotify.py
(1.75 KB)
??
malware_filters.py
(3.59 KB)
??
mr_proper.py
(2.67 KB)
??
plesk_notifications.py
(4.59 KB)
??
post_action.py
(1.72 KB)
??
restore_from_backup.py
(3.37 KB)
??
send_malware_infection_state.py
(11.51 KB)
??
server_pull.py
(2.56 KB)
??
service_manager.py
(3.93 KB)
Editing: detect_admin_tools_watcher.py
""" 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 <https://www.gnu.org/licenses/>. Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see <https://www.imunify360.com/legal/eula> """ import logging from defence360agent.contracts.config import SystemConfig from defence360agent.contracts.messages import ConfigUpdate from defence360agent.contracts.plugins import MessageSink, expect from defence360agent.utils import LazyLock, Scope from imav.contracts.config import Malware as MalwareConfig from imav.malwarelib.subsys import aibolit from imav.malwarelib.subsys.malware import HackerTrapHitsSaver logger = logging.getLogger(__name__) class DetectAdminToolsWatcher(MessageSink): SCOPE = Scope.IM360 # Must be a class attribute — LazyLock is a descriptor whose # ``__get__`` is only invoked for class-level access. Without the # lock, two ConfigUpdate messages in the same event-loop tick can # read the same ``_previous_detect_admin_tools`` snapshot and fire # the resync in the wrong order. See DEF-38724. _lock = LazyLock() def __init__(self): self._previous_detect_admin_tools = MalwareConfig.DETECT_ADMIN_TOOLS async def create_sink(self, loop) -> None: # Boot-time rebuild owned by ``StartupActions.reset_sa_hits`` # (which honours DETECT_ADMIN_TOOLS via the SQL filter). pass @expect(ConfigUpdate) async def on_config_update(self, message: ConfigUpdate): if not isinstance(message["conf"], SystemConfig): return async with self._lock: current_value = MalwareConfig.DETECT_ADMIN_TOOLS if self._previous_detect_admin_tools == current_value: return logger.info( "DETECT_ADMIN_TOOLS changed from %s to %s, restarting" " ai-bolit", self._previous_detect_admin_tools, current_value, ) self._previous_detect_admin_tools = current_value await aibolit.restart_on_detect_admin_tools_update() await HackerTrapHitsSaver.reset_sa_hits()
Upload File
Create Folder