!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.3.29 

uname -a: Linux tardis23.nocplanet.net 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024
x86_64
 

 

Safe-mode: OFF (not secure)

/opt/imunify360/venv/share/imunify360/scripts/migrate_csf/   drwxr-xr-x
Free 1008.5 GB of 1859.98 GB (54.22%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     main.py (2 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/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)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0183 ]--