403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.137.173.98
Web Server : Apache
System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : nobody ( 99)
PHP Version : 5.6.40
Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime
MySQL : ON |  cURL : ON |  WGET : ON |  Perl : ON |  Python : ON |  Sudo : ON |  Pkexec : ON
Directory :  /scripts/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /scripts/fix_pear_registry
#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/fix_pear_registry               Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use Cpanel::Imports;
use Cpanel::Binaries        ();
use Cpanel::Pkgr            ();
use Cpanel::SafeRun::Object ();

# This script is intended to clean up after the Horde and other PEAR RPMs that had
# a faulty %postun. This has since been fixed, but the script is needed as a one-time
# operation to repair the PEAR registry, since the %postun of the old RPM is executed
# after the new RPM's %post has already run. This could be handled with a %triggerpostun,
# but that would add a new element to the long-term behavior of the RPMs, which is
# undesirable for this one-time cleanup measure.

exit run(@ARGV) unless caller;

sub run {

    my %report;

    my $pear_bin = Cpanel::Binaries::CPANEL_PHP_BIN() . '/pear';    # Don't use Cpanel::FindBin for this. It may grab the system pear, which we don't want.

    my $php_rpm_prefix          = 'cpanel-php' . Cpanel::Binaries::get_php_version( flat => 1 ) . '*';
    my @installed_pear_packages = keys( %{ Cpanel::Pkgr::installed_packages($php_rpm_prefix) } );
    $report{installed} = @installed_pear_packages;

    for my $pkg ( sort @installed_pear_packages ) {
        my $xmlfile = Cpanel::Binaries::CPANEL_PHP . '/lib/pear/' . $pkg . '.xml';
        if ( -f $xmlfile ) {

            my $package_is_registered = is_registered($pkg);

            if ($package_is_registered) {
                logger->info( locale->maketext( 'The “[_1]” package is already in the [asis,PEAR] registry.', $pkg ) );
                $report{already_registered}++;
                next;
            }

            $report{not_already_registered}++;

            my @pear_args = ( qw(install --nodeps --force --register-only), $xmlfile );
            my $run       = Cpanel::SafeRun::Object->new(
                program => $pear_bin,
                args    => \@pear_args,
            );
            if ( $run->CHILD_ERROR || !is_registered($pkg) ) {
                logger->warn( locale->maketext( 'The system failed to add the [asis,PEAR] registry entry for “[_1]”: [_2]', $pkg, $run->stdout ) );    # pear errors are on stdout, and pear may exit zero without actually doing anything
                logger->warn("Command: $pear_bin @pear_args");
                $report{failed}++;
            }
            else {
                print $run->stdout;
                logger->info( locale->maketext( 'The system added the [asis,PEAR] registry entry for “[_1]”.', $pkg ) );
                $report{succeeded}++;
            }
        }
        else {
            logger->info( locale->maketext( 'The system could not find the [asis,XML] file for “[_1]”.', $pkg ) );
            $report{no_xml}++;
        }
    }

    logger->info(
        locale->maketext(
            'There are [numf,_1] installed [asis,PEAR] packages. Of those packages, [numf,_2] already existed in the [asis,PEAR] registry, [numf,_3] did not, and [numf,_4] did not contain an [asis,XML] file. Of the [quant,_3,package,packages] not listed in the registry, the system successfully added [numf,_5], and failed to add [numf,_6].',
            map { $_ || 0 } @report{qw(installed already_registered not_already_registered no_xml succeeded failed )}
        )
    );

    # We can't count on every single PEAR package to always register successfully, so only exit nonzero if something
    # very bad like the pear binary being missing occurred.

    return 0;
}

sub is_registered {
    my ($pkg) = @_;
    my $pear_bin = Cpanel::Binaries::THIRD_PARTY_BIN . '/pear';
    return scalar grep {
        my $channel   = $_;
        my @pear_args = ( qw(list -c horde), "$channel/$pkg" );
        my $run       = Cpanel::SafeRun::Object->new(
            program => $pear_bin,
            args    => \@pear_args,
        );
        !$run->CHILD_ERROR;
    } 'horde', 'pear';
}

Youez - 2016 - github.com/yon3zu
LinuXploit