!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/opt/alt/python37/lib/python3.7/site-packages/clwpos/   drwxr-xr-x
Free 232.95 GB of 981.82 GB (23.73%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     collect_information.py (5.15 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/opt/alt/python37/bin/python3

# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT
#


import json
import argparse
import os
import logging

from clwpos.logsetup import setup_logging
from clwpos.feature_suites import (
    get_allowed_modules,
    get_admin_config_directory,
    get_admin_config_permissions,
)
from clwpos.utils import acquire_lock, user_uid, get_pw, is_wpos_supported
from clwpos.daemon import whmapi1, WposDaemon

_logger = setup_logging(
    caller_name='collect_information',
    file_level=logging.INFO,
    logfile_path='/var/log/clwpos/collect_information.log',
)


def php_get_vhost_versions():
    """
    @return: [
        {
            "account": "rm3",
            "account_owner": "root",
            "documentroot": "/home/example/public_html",
            "homedir": "/home/rm3",
            "is_suspended": 0,
            "main_domain": 1,
            "php_fpm": 1,
            "php_fpm_pool_parms": {
                "pm_max_children": 5,
                "pm_max_requests": 20,
                "pm_process_idle_timeout": 10
            },
            "phpversion_source": [
                {
                    "domain": "example.com",
                    "system_default": 1
                }
            ],
            "version": "ea-php72",
            "vhost": "otherchars.rm3.tld"
        }
    ]
    """
    return whmapi1(WposDaemon.DAEMON_PHP_GET_VHOST_VERSIONS_COMMAND)["versions"]


def php_get_installed_versions():
    """
    @return: [
        "ea-php74"
    ]
    """
    return whmapi1(WposDaemon.DAEMON_PHP_GET_INSTALLED_VERSIONS_COMMAND)["versions"]


def listaccts():
    """
    @return: [
        {
            "backup": 0,
            "child_nodes": [
                {
                    "alias": "nodealias",
                    "workload": "Mail"
                }
            ],
            "disklimit": "unlimited",
            "diskused": "14M",
            "domain": "example.com",
            "email": "username@example.com",
            "has_backup": 1,
            "inodeslimit": "unlimited",
            "inodesused": 1,
            "ip": "192.168.0.128",
            "ipv6": [
                "0101:ca75:0101:ca75:0101:ca75:0101:ca77"
            ],
            "is_locked": 0,
            "legacy_backup": 0,
            "mailbox_format": "mdbox",
            "max_defer_fail_percentage": "unlimited",
            "max_email_per_hour": "unlimited",
            "max_emailacct_quota": "unlimited",
            "maxaddons": "unlimited",
            "maxftp": "unlimited",
            "maxlst": "unlimited",
            "maxparked": "unlimited",
            "maxpop": "unlimited",
            "maxsql": "unlimited",
            "maxsub": "unlimited",
            "min_defer_fail_to_trigger_protection": "unlimited",
            "outgoing_mail_hold": 1,
            "outgoing_mail_suspended": 0,
            "owner": "root",
            "partition": "home",
            "plan": "packagename",
            "shell": "/bin/bash",
            "startdate": "13 May 22 16:03",
            "suspended": 0,
            "suspendreason": "not suspended",
            "suspendtime": 1594040856,
            "temporary": 0,
            "theme": "paper_lantern",
            "uid": 1001,
            "unix_startdate": 1369256589,
            "user": "username"
        }
    ]
    """
    return whmapi1("listaccts")["acct"]


if __name__ == '__main__' and is_wpos_supported():
    with acquire_lock(os.path.join('/var/run/collect_information.lock',), attempts=None):
        parser = argparse.ArgumentParser(description="Utility to collect information about user for AccelerateWP")
        parser.add_argument("user", type=str, nargs="?")
        args = parser.parse_args()

        installed_versions = php_get_installed_versions()
        vhost_versions = php_get_vhost_versions()

        target_accounts = listaccts()
        target_accounts = list(filter(lambda x: get_allowed_modules(int(x["uid"])), target_accounts))

        if args.user is not None:
            target_accounts = list(filter(lambda x: int(x["uid"]) == user_uid(username=args.user), target_accounts))

        for account in target_accounts:
            username = account["user"]
            filtered_vhost_versions = [version for version in vhost_versions if version["account"] == username]
            try:
                pw = get_pw(username=username)

                admin_config_dir = get_admin_config_directory(pw.pw_uid)
                info_json = os.path.join(admin_config_dir, "info.json")

                with open(info_json, "w") as f:
                    json.dump(
                        {"installed_versions": installed_versions,
                         "vhost_versions": filtered_vhost_versions},
                        f,
                    )

                owner, group, mode = get_admin_config_permissions(pw.pw_gid)
                os.chown(info_json, owner, group)
                os.chmod(info_json, mode)

            except Exception as e:
                _logger.exception("Error during collecting information for %s: %s", username, e)
                continue

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.017 ]--