Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.142.199.54
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/advisor.py
from collections import defaultdict

from defence360agent.contracts.config import ConfigFile
from defence360agent.rpc_tools.lookup import RootEndpoints
from defence360agent.utils.config import update_config
from defence360agent.rpc_tools import lookup
from defence360agent.api.server.events import EventsAPI
from defence360agent.feature_management.checkers import config_cleanup


class AdvisorEndpoints(RootEndpoints):
    @lookup.bind("advisor", "apply")
    async def advisor_apply(self, advices):
        return await self._apply(advices)

    @lookup.bind("advisor", "apply-all")
    async def apply_all(self):
        advices = await EventsAPI.advices()
        return await self._apply(advices)

    async def _apply(self, advices):
        target_conf = defaultdict(dict)
        current_conf = ConfigFile().config_to_dict()
        for advise in advices:
            self._extract_conf_from_advise(advise, current_conf, target_conf)

        await update_config(self._sink, target_conf)
        return {"items": config_cleanup(ConfigFile().config_to_dict())}

    @staticmethod
    def _extract_conf_from_advise(advise, current_conf, target_conf):
        for section_key, section_value in advise["ignore"].items():
            for value_key, ignored_values in section_value.items():
                if current_conf[section_key][value_key] in ignored_values:
                    return
        for section_key, section_value in advise["config_action"].items():
            target_conf[section_key].update(section_value)

Youez - 2016 - github.com/yon3zu
LinuXploit