LittleDemon WebShell


Linux server27.hostingraja.org 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64
Path : /opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/
File Upload :
Command :
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/startup_actions.py

import asyncio
from logging import getLogger
from pathlib import Path

from defence360agent.contracts.config import Core
from defence360agent.contracts.plugins import MessageSink
from defence360agent.subsys.panels.hosting_panel import HostingPanel
from defence360agent.utils import create_task_and_log_exceptions
from imav.malwarelib.subsys.malware import HackerTrapHitsSaver

logger = getLogger(__name__)


class StartupActions(MessageSink):
    PANEL_NAME_PATH = Path(Core.GLOBAL_CONFDIR) / "panel-name.txt"
    RETRY_TIMEOUT = 5 * 60  # 5 minutes

    def _create_tasks(self):
        async def sleep_on_error(*_):
            await asyncio.sleep(self.RETRY_TIMEOUT)

        tasks = [
            create_task_and_log_exceptions(
                self._loop, HackerTrapHitsSaver.reset_sa_hits
            ),
        ]
        return tasks

    async def create_sink(self, loop):
        self._loop = loop
        self._tasks = self._create_tasks()

    async def update_panel_name(self):
        self.PANEL_NAME_PATH.write_text(HostingPanel().NAME)

    async def shutdown(self):
        for task in self._tasks:
            task.cancel()
        await asyncio.gather(*self._tasks, return_exceptions=True)

LittleDemon - FACEBOOK
[ KELUAR ]