HEX
Server: LiteSpeed
System: Linux linux31.centraldnserver.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
User: salamatk (1501)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open
Upload Files
File: //proc/self/root/opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/repeater.py
import asyncio
from logging import getLogger

from defence360agent.contracts.config import UserConfig
from defence360agent.contracts.messages import MessageType
from defence360agent.contracts.plugins import MessageSink, expect
from im360.simple_rpc.resident_socket import send_to_socket

logger = getLogger(__name__)


class Repeater(MessageSink):
    async def create_sink(self, loop):
        self._loop = loop

    @expect(MessageType.FilesUpdated)
    async def resend_to_generic_socket(self, msg):
        asyncio.create_task(
            send_to_socket(
                msg={
                    "method": "FILES_UPDATE",
                    "files_type": msg["files_type"],
                },
                wait_for_response=False,
            )
        )

    @expect(MessageType.ConfigUpdate)
    async def resend_config_update_to_generic_socket(self, msg):
        if isinstance(msg["conf"], UserConfig):
            return  # do nothing for non-root config updates
        asyncio.create_task(
            send_to_socket(
                msg={
                    "method": "UPDATE_RULES",
                },
                wait_for_response=False,
            )
        )