[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: main.py
File is not writable. Editing disabled.
#!/opt/imunify360/venv/bin/python import argparse import pathlib import subprocess import sys import logging from country import migrate_country_codes from smtp import migrate_smtp from ips import migrate_ips from logger_config import setup_logger, capture_exception def is_csf_running() -> bool: csf_app = "/usr/sbin/csf" if not pathlib.Path(csf_app).exists(): return False return ( subprocess.run( [csf_app, "--status"], capture_output=True, text=True ).returncode == 0 ) def csf_conf_exists() -> bool: return pathlib.Path("/etc/csf/csf.conf").exists() def should_migrate(logger: logging.Logger) -> bool: if not csf_conf_exists(): logger.error( "CSF configuration file does not exist, skipping migration" ) return False return True def parse_args(): """Parse command line arguments.""" parser = argparse.ArgumentParser( description="Migrate CSF configuration to Imunify360" ) parser.add_argument( "--debug", action="store_true", help="Enable debug logging output" ) return parser.parse_args() if __name__ == "__main__": args = parse_args() # Setup logger with debug flag (also initializes Sentry) logger = setup_logger(debug_enabled=args.debug) if not should_migrate(logger): sys.exit(1) try: logger.info("Starting CSF to Imunify migration") migrate_country_codes() migrate_smtp() migrate_ips() logger.info("CSF to Imunify migration done") if is_csf_running(): logger.warning(""" ################################################### CSF is running, please stop it by running: csf -x systemctl disable csf systemctl disable lfd ###################################################""") except Exception as e: logger.error(f"Fatal error during migration: {e}") capture_exception( e, {"migration_phase": "main", "script": "migrate_csf"} ) sys.exit(1)
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium264.web-hosting.com
Server IP: 69.57.162.13
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium264.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 73.6 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: kidscntx
User ID (UID): 1154
Group ID (GID): 1112
Script Owner UID: 1154
Current Dir Owner: N/A