GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 173.249.157.85  /  Your IP : 18.224.212.19
Web Server : Apache
System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : econtech ( 1005)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  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/check_cpanel_pkgs
#!/bin/bash
eval '/usr/local/cpanel/scripts/fix-cpanel-perl && exec /usr/local/cpanel/3rdparty/bin/perl -x -- $0 ${1+"$@"}'    ## no critic qw(ProhibitStringyEval RequireUseStrict RequireUseWarnings)
  if 0;

#!/usr/bin/perl
# cpanel - scripts/check_cpanel_pkgs                 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

package scripts::check_cpanel_pkgs;

# This script will handle repairing/listing broken RPMs
# -
# Q: What is a broken aka altered RPM?
# A: Any files output by a rpm -V RPM_PACKAGE_NAME that are listed to have a different MD5 sum or permission change indicate a broken RPM.

use strict;
use warnings;

use Cpanel::Usage               ();
use Cpanel::Update::Logger      ();
use Cpanel::RPM::Versions::File ();
use Cpanel::TempFile            ();
use Cpanel::LoadModule          ();

exit __PACKAGE__->script(@ARGV) unless caller();

sub script {
    my ( $class, @argv ) = @_;

    local $| = 1;

    my $list_only         = 0;
    my $long_list         = 0;
    my $fix               = 0;
    my $contact           = 0;
    my $targets           = 0;
    my $nodir             = 0;
    my $skip_digest_check = 0;
    my $skip_broken_check = 0;
    my $download_only     = 0;

    my %opts = (
        'long-list'     => \$long_list,
        'list-only'     => \$list_only,
        'fix'           => \$fix,
        'notify'        => \$contact,
        'targets'       => \$targets,
        'nodir'         => \$nodir,
        'no-digest'     => \$skip_digest_check,
        'no-broken'     => \$skip_broken_check,
        'download-only' => \$download_only,
    );

    my $self = bless {
        'notification_rpms' => [],
    }, $class;

    my $status = Cpanel::Usage::wrap_options( { strict => 1 }, \@argv, \&usage, \%opts ) || 0;
    usage(1) if $status > 2;
    usage(1) if ( $list_only && $fix );

    my $logger = Cpanel::Update::Logger->new( { 'stdout' => 1, 'log_level' => 'info' } );

    my $temp;
    my %directory_options = ();
    if ($nodir) {
        $temp = Cpanel::TempFile->new;
        my $tempdir = $temp->dir;
        $directory_options{'directory'} = $tempdir;
    }

    my $v;
    if ($targets) {
        my @targets = split( /\s*,\s*/, $targets );
        $v = Cpanel::RPM::Versions::File->new( { 'only_targets' => \@targets, logger => $logger, %directory_options } );
    }
    else {
        $v = Cpanel::RPM::Versions::File->new( { logger => $logger, %directory_options } );
    }

    # need to be sure that the update config is saved if we detect an *disable file
    $v->dir_files()->save() if $v->dir_files()->config_changed();

    my $found = 0;

    my $installed_rpms = $v->list_rpms_in_state("installed");
    my $upgraded_rpms  = $v->list_rpms_in_state("upgraded");

    my $missing_rpms = $v->install_hash( $installed_rpms, $upgraded_rpms );

    if (%$missing_rpms) {
        $found++;

        log_header($logger);
        $logger->info("The following packages are missing from your system:");

        foreach my $rpm ( sort keys %$missing_rpms ) {
            $logger->info("$rpm-$missing_rpms->{$rpm}");
            $self->_store_rpm_for_notify( "$rpm-$missing_rpms->{$rpm}", 'missing' );
        }
    }

    my $unnecessary_rpms = $v->uninstall_hash($installed_rpms);

    if (%$unnecessary_rpms) {
        $found++;
        log_header($logger);
        $logger->info(" ");
        $logger->info("The following packages are unneeded on your system and should be uninstalled:");

        foreach my $rpm ( sort keys %$unnecessary_rpms ) {
            $logger->info("$rpm-$unnecessary_rpms->{$rpm}");
            $self->_store_rpm_for_notify( "$rpm-$unnecessary_rpms->{$rpm}", 'unnecessary' );

        }
    }

    # The hash reference returned by get_dirty_rpms() looks like:
    # {
    #    'nsd,3.2.9-2.cp1136' => [
    #                               '/etc/nsd'
    #                            ]
    # };

    # Delete cached results otherwise this will need to be run twice if a RPM is altered.
    # NOTE: This was changed recently. $v->reinstall is responsible for clearing this cache when appropriate.
    # I will remove these comments in a future commit but leaving it here so the bug is obvious in the short
    # term if it comes up.
    #
    #unless ($skip_broken_check) {
    #    $v->clear_installed_packages_cache;
    #}

    # Suppress warnings from get_dirty_rpms call.
    $v->logger->set_logging_level('ERROR');
    my $broken_rpms = $skip_broken_check ? {} : $v->get_dirty_rpms($skip_digest_check);
    $v->logger->set_logging_level('INFO');

    my @broken_rpms_list = sort keys %$broken_rpms;

    if (%$broken_rpms) {
        $found++;

        log_header($logger);
        $logger->info(" ");
        $logger->info("The following files were found to be altered from their original package form:") if ( !$long_list );
        foreach my $rpm ( sort keys %$broken_rpms ) {
            foreach ( @{ $broken_rpms->{$rpm} } ) {
                my ( $broken_file, $reason ) = @$_;
                $logger->info("$rpm,$reason,$broken_file") if $long_list;
                $self->_store_rpm_for_notify( "$rpm-$broken_file", 'broken', $reason );

            }
            $logger->info("$rpm") if !$long_list;
        }

        $logger->info(" ");
    }

    if ($found) {

        # Fix if necessary.
        if ($download_only) {
            $v->download_all();
        }
        elsif ( !$list_only ) {
            if ( !$fix ) {
                $fix = prompt('Do you want to repair these packages?');
            }

            if ($fix) {
                $v->logger->{'stdout'} = 1;
                $v->logger->set_logging_level('INFO');
                $v->reinstall_rpms(@broken_rpms_list);
                foreach my $rpm ( @{ $self->{'notification_rpms'} } ) {

                    # TODO: reinstall_rpms assumes success here
                    $rpm->{'status'} = $rpm->{'status'} eq 'broken' ? 'repaired' : $rpm->{'status'};
                }
            }

        }

        $self->notify() if $contact;
    }

    return $logger->get_need_notify ? 2 : 0;
}

sub _store_rpm_for_notify {
    my ( $self, $rpm, $status, $info ) = @_;

    push @{ $self->{'notification_rpms'} }, {
        'rpm'    => $rpm,
        'status' => $status,    #unnecessary #broken #missing #repaired
        'info'   => $info,
    };

    return 1;
}

sub notify {
    my ($self) = @_;

    Cpanel::LoadModule::load_perl_module("Cpanel::iContact::Class::Check::CpanelPackages") || return;

    require Cpanel::Notify;
    Cpanel::Notify::notification_class(
        'class'            => 'Check::CpanelPackages',
        'application'      => 'Check::CpanelPackages',
        'constructor_args' => [
            origin => 'rpmcheck',
            rpms   => $self->{'notification_rpms'},
        ]
    );
}

sub prompt {
    return 0 if ( !-t STDIN );

    print shift @_;

    my $response = '';

    eval { require Term::ReadKey };
    unless ($@) {
        local $SIG{INT} = sub { Term::ReadKey::ReadMode( 'restore', *STDIN ); exit };
        Term::ReadKey::ReadMode( 'noecho', *STDIN );
        Term::ReadKey::ReadMode( 'raw',    *STDIN );

        $response = '';
        while ( $response !~ m{^[ynYN]$} ) {
            print "(y/n):\n";
            $response = getc(*STDIN);
        }

        Term::ReadKey::ReadMode( 'restore', *STDIN );
        print "$response\n";
    }
    else {
        my $response = <>;
        while ( $response !~ m{^[ynYN]$} ) {
            print "(y/n):\n";
            $response = getc(*STDIN);
        }
    }
    return ( $response =~ m{[yY]} ) ? 1 : 0;
}

{
    my $_has_header;

    sub log_header {
        return if $_has_header;
        my ($logger) = @_;
        my $header .= <<END;
Problems were detected with cPanel-provided files which are controlled by packages.
If you did not make these changes intentionally, you can correct them by running:

> /usr/local/cpanel/scripts/check_cpanel_pkgs --fix

END
        $logger->info('');
        foreach my $line ( split( /\n/, $header ) ) {
            $logger->info($line);
        }

        $_has_header = 1;
    }
}

sub usage {
    my $exit_code    = shift || 0;
    my $program_name = $0;
    $program_name =~ s{/usr/local/cpanel/}{};

    # TODO: Describe the output on Debian-like systems.
    print qq{
    $program_name
      Responsible for validating the integrity of cPanel-managed packages and their corresponding files.
      This script detects if there are any packages that have been unexpectedly altered. Files are
      considered altered:

       - If their ownership has changed,
       - If they contain an MD5 mismatch
       - If they are a symlink, the file points to the wrong path.

      Any packages that should be installed or uninstalled will also be detected.

      $program_name offers the opportunity to repair these issues by reinstalling the package that contains the
      altered file(s).

    Usage:
      $program_name [options]

    Options:
      --fix       - Show any problems and automatically correct them.
      --list-only - Only list altered packages and then exit.
      --download-only - Downloads packages and exit
      --long-list - Show in a more easily parsed format the altered packages and files.
      --notify    - Send out a notification regarding any altered packages Additionally,
                    it will describe any action that was taken.
      --targets   - Filter packages based on provided targets (comma delimited).
      --nodir     - This option will prevent the directory /var/cpanel/rpm.versions.d from being read.
      --no-digest - This option will speed up “$0” run by skipping file digest checks.
                    Changes to the contents of files will not be detected.
      --no-broken - This option will prevent the system from checking for broken packages
                    and it will only install missing and uninstall unneeded ones.

    Checks Performed:
      On systems which use RPM packages, $program_name runs the rpm -V check on all cPanel-managed RPMs.
      rpm -V determines if the files have changed since their installation; configuration and documentation
      files are ignored in this process. The table below shows the changes detected in the output of rpm -V.

      Note: If the output indicates that only Mode or mTime have changed, then that file will not be
      labeled as "changed."

      Check  | Description
        S    | File Size differs.
        M    | Mode differs (includes permissions and file type).
        5    | MD5 sum differs.
        D    | Device major/minor number mismatch.
        L    | readLink(2) path mismatch.
        U    | User ownership differs.
        G    | Group ownership differs.
        T    | mTime differs.

};

    exit $exit_code;
}

1;

Youez - 2016 - github.com/yon3zu
LinuXploit