403Webshell
Server IP : 62.60.133.156  /  Your IP : 216.73.217.51
Web Server : LiteSpeed
System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64
User : mimradmin ( 1166)
PHP Version : 7.4.33
Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : OFF |  Pkexec : OFF
Directory :  /opt/imunify360/venv/lib64/python3.11/site-packages/im360/subsys/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /opt/imunify360/venv/lib64/python3.11/site-packages/im360/subsys/int_config.py
from configparser import ConfigParser
from defence360agent.utils import is_cloudways
from im360.utils import coraza_for_cloudways_hybrid_flag

# This code is a ported copy-paste from Go agent.


def _get_server_type(path: str, raise_err: bool) -> str:
    try:
        cfg = ConfigParser()
        cfg.read(path)
        return cfg.get("web_server", "server_type", fallback="")
    except Exception:
        if raise_err:
            raise
    return ""


def _is_nginx_server(path: str, raise_err: bool) -> bool:
    return _get_server_type(path, raise_err) == "nginx"


def is_force_use_coraza(
    *,
    path: str = "/etc/sysconfig/imunify360/integration.conf",
    raise_err: bool = False,
    detect_cloudways: bool = True,
) -> bool:
    if not _is_nginx_server(path, raise_err):
        return False
    if detect_cloudways:
        return is_cloudways()
    return True


def is_cloudways_hybrid(
    *,
    path: str = "/etc/sysconfig/imunify360/integration.conf",
    raise_err: bool = False,
    detect_cloudways: bool = True,
) -> bool:
    if _get_server_type(path, raise_err) != "apache":
        return False
    if not coraza_for_cloudways_hybrid_flag():
        return False
    if detect_cloudways:
        return is_cloudways()
    return True


def generic_panel_uses_coraza() -> bool:
    return is_force_use_coraza() or is_cloudways_hybrid()

Youez - 2016 - github.com/yon3zu