| 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 : /proc/self/root/opt/imunify360/venv/lib64/python3.11/site-packages/im360/subsys/ |
Upload File : |
from enum import StrEnum, unique
from pathlib import Path
from im360.subsys.int_config import is_cloudways_hybrid
from im360.utils import is_apache2nginx_enabled, use_coraza4cpanel
_CONF_PATH = Path("/usr/share/imunify360-webshield/modularity_mode")
@unique
class Mode(StrEnum):
STANDALONE = "standalone"
APACHE = "apache"
NGINX = "nginx"
@classmethod
def get(cls):
try:
mode = _CONF_PATH.read_text().strip()
if mode == "apache":
return cls.APACHE
if mode == "nginx":
return cls.NGINX
if mode == "standalone":
return cls.STANDALONE
raise TypeError(f"Unknown mode: {mode}")
except FileNotFoundError:
return cls.STANDALONE
@classmethod
def wants_redirect(cls, mode) -> bool:
return (
mode in (cls.STANDALONE, cls.APACHE)
or is_apache2nginx_enabled()
or use_coraza4cpanel()
or is_cloudways_hybrid()
)
def get_module_based_ports() -> set[int]:
# For now - hardcoded values. In the future maybe remake to a config file.
return {80, 443}