403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.145.95.107
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
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/application/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/application/determine_hosting_panel.py
"""
Determines hosting panel.
This module has minimal dependencies and only imports required panel class.
"""
import logging
from importlib import import_module
from pathlib import Path

CPANEL_FILE = "/usr/local/cpanel/cpanel"
DA_FILE = "/usr/local/directadmin/directadmin"
PLESK_FILE = "/usr/sbin/plesk"
GP_FILE = "/etc/sysconfig/imunify360/integration.conf"

logger = logging.getLogger(__name__)


def get_hosting_panel(root_module: str):  # pragma no cover
    # note: keep the panel test order in sync with the deploy script,
    #   to avoid detecting conflicting panels in agent vs. the deploy script
    if is_generic_panel_installed():
        # Checking this panel first is convenient for development, since
        # it allows you to turn any panel in the Generic Panel simply by
        # creating `/etc/sysconfig/imunify360/integration.conf`.
        module = import_module(f"{root_module}.subsys.panels.generic.panel")

        return module.GenericPanel()
    elif is_plesk_installed():
        module = import_module(f"{root_module}.subsys.panels.plesk.panel")

        return module.Plesk()
    elif is_cpanel_installed():
        module = import_module(f"{root_module}.subsys.panels.cpanel.panel")

        return module.cPanel()
    elif is_directadmin_installed():
        module = import_module(
            f"{root_module}.subsys.panels.directadmin.panel"
        )

        return module.DirectAdmin()
    elif root_module == "defence360agent":
        module = import_module(f"{root_module}.subsys.panels.no_cp.panel")

        return module.NoCP()

    module = import_module(f"{root_module}.subsys.panels.no_cp.panel")

    return module.NoControlPanel()


def is_cpanel_installed():
    return _is_panel_installed(CPANEL_FILE)


def is_directadmin_installed():
    return _is_panel_installed(DA_FILE)


def is_generic_panel_installed():
    return _is_panel_installed(GP_FILE)


def is_plesk_installed():
    return _is_panel_installed(PLESK_FILE)


def _is_panel_installed(panel_file):
    return Path(panel_file).is_file()

Youez - 2016 - github.com/yon3zu
LinuXploit