shell bypass 403

UnknownSec Shell

: /scripts/ [ drwxr-xr-x ]

name : check_mysql
#!/usr/local/cpanel/3rdparty/bin/perl

#                                      Copyright 2024 WebPros International, LLC
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

package scripts::check_mysql;

use strict;
use warnings;

use Cpanel::Services::Enabled        ();
use Cpanel::ConfigFiles              ();
use Cpanel::Daemonizer::Tiny         ();
use Cpanel::FileUtils::Open          ();
use Cpanel::FindBin                  ();
use Cpanel::DB::Reserved             ();
use Cpanel::MysqlUtils::MyCnf::Basic ();
use Cpanel::MysqlUtils::Dir          ();
use Cpanel::Alarm                    ();
use Cpanel::Unix::PID::Tiny          ();
use Cpanel::Imports;

exit script(@ARGV) unless caller;

sub report_errors {
    my ($errors) = @_;

    require Cpanel::Notify;
    Cpanel::Notify::notification_class(
        'class'            => 'Check::MySQL',
        'application'      => 'Check::MySQL',
        'constructor_args' => [
            'origin' => 'check_mysql',
            'report' => $errors,
        ]
    );

    return;
}

sub run_mysqlcheck {
    my ( $mysqlcheck, $db ) = @_;

    my @output = `LANG=C $mysqlcheck -u root -m --silent --databases $db 2>&1`;
    return @output;
}

sub daemon_process {
    my ($uxpd) = @_;
    $uxpd->pid_file('/var/run/check_mysql.pid');    # update our pid file to new sporked PID

    # These are the databases we analyze
    my @databases = grep { !m/^pg_/ && !m/^postgres$/ && !m/^test$/ } Cpanel::DB::Reserved::get_reserved_database_names();

    my $timeout_seconds = 64800;                    # 64800 seconds == 18 hours
    my $mysqlcheck      = Cpanel::FindBin::findbin("mariadb-check") || Cpanel::FindBin::findbin("mysqlcheck");
    my $mysqldir        = Cpanel::MysqlUtils::Dir::getmysqldir()    || '/var/lib/mysql';
    my %errors;
    my %processed;
    my $ret = eval {

        # must go out of scope to stop and clean up, ick on a stick
        my $timeout = Cpanel::Alarm->new( $timeout_seconds, sub { die "time out\n" } );
        for my $db (@databases) {
            if ( $db ne 'mysql' && !-d "$mysqldir/$db" ) {    # if mysql is missing then @output contains an error
                $processed{$db} = 1;
                next;
            }

            logger->info("starting mysqlcheck on $db (PID $$)");
            my @output = run_mysqlcheck( $mysqlcheck, $db );
            if ( grep { /error: 2002: Can't connect/ } @output ) {
                logger->warn("mysqlcheck can't connect to MySQL");
                return 0;
            }
            logger->info("mysqlcheck of $db is finished (PID $$)");
            my $oops = purge_warnings( \@output );
            if ($oops) {
                logger->warn("mysqlcheck found errors on $db: $oops");
                $errors{$db} = $oops;
            }
            else {
                logger->info("mysqlcheck found no errors on $db");
            }
            $processed{$db} = 2;
        }
        return 1;
    };
    return if defined $ret && $ret == 0;

    for my $db (@databases) {
        next if exists $processed{$db};
        next if $db ne 'mysql' && !-d "$mysqldir/$db";    # in case the timeout happened right before $processed{$db} = 1; we just won a race!
        my $timeout_hours = $timeout_seconds / 60 / 60;
        $errors{$db} = "not checked because mysqlcheck has been running for $timeout_hours hours (large data? $mysqldir partition full?)";
    }

    if ( keys %errors ) {
        report_errors( \%errors );
    }

    return;
}

sub script {
    local $ENV{'HOME'} = '/root';

    die "/usr/local/cpanel/scripts/check_mysql is currently disabled.\n" if -e '/etc/check_mysql_disable';

    die "MySQL is disabled.\n" unless Cpanel::Services::Enabled::is_enabled('mysql');

    # This script is not written in a way so as to support remote mysql servers
    die "Remote MySQL database servers are not supported.\n" if Cpanel::MysqlUtils::MyCnf::Basic::is_remote_mysql();

    # this can be an expensive and thus time consuming thing so only allow one run at a time and give it a large timeout (via $timeout_seconds)
    my $uxpd = Cpanel::Unix::PID::Tiny->new();
    die "/usr/local/cpanel/scripts/check_mysql is currently running.\n" if !$uxpd->pid_file('/var/run/check_mysql.pid');

    my $pid = Cpanel::Daemonizer::Tiny::run_as_daemon(
        sub {
            Cpanel::FileUtils::Open::sysopen_with_real_perms( \*STDERR, $Cpanel::ConfigFiles::CPANEL_ROOT . '/logs/error_log', 'O_WRONLY|O_APPEND|O_CREAT', 0600 );
            open( STDOUT, '>&', \*STDERR ) || warn "Failed to redirect STDOUT to STDERR";
            daemon_process($uxpd);
        }
    );

    print locale->maketext( "“[_1]” will complete in the background (process ID [_2]).", 'check_mysql', $pid ) . "\n";

    return 0;
}

sub purge_warnings {
    my ($output_ar) = @_;

    my $full_output = '';

    # Loop through each line get rid of warnings
    my $previous_line = '';
    foreach my $line (@$output_ar) {
        chomp $line;

        # Skip the warnings and a non-Error-error: http://bugs.mysql.com/bug.php?id=30487
        if ( $line =~ /^([iI]nfo|[nN]ote|[wW]arning)/ || $line =~ m/Error\s*:\s*You can't use locks with log tables\./ ) {
            $previous_line = '';
            next;
        }

        # We only allow a line if it is not followed by a warning
        $full_output .= $previous_line . "\n" if $previous_line;
        $previous_line = $line;
    }

    $full_output .= $previous_line . "\n" if $previous_line;
    return $full_output;
}

© 2025 UnknownSec
Display on the page Footer | Anyleson - Learning Platform
INR (₹)
India Rupee
$
United States Dollar

Display on the page Footer

Privacy Policy

Effective Date: 24 August , 2024

At Anyleson, we are committed to protecting your privacy and ensuring that your personal information is handled securely and responsibly. This Privacy Policy outlines how we collect, use, and safeguard your data when you use our platform.


Information We Collect


  1. Personal Information:

    • Name, email address, phone number, and billing details.

    • Account login credentials (username and password).



  2. Course Usage Data:

    • Progress and activity within courses.

    • Feedback and reviews submitted for courses.



  3. Technical Information:

    • IP address, browser type, device information, and cookies for improving website functionality.



  4. Communication Data:

    • Information from your interactions with our customer support.




How We Use Your Information


  1. To Provide Services:

    • Process course purchases, registrations, and access to content.



  2. To Improve User Experience:

    • Analyze user behavior to enhance course offerings and platform features.



  3. To Communicate:

    • Send updates, notifications, and promotional offers (only if you’ve opted in).



  4. For Legal Compliance:

    • Meet legal or regulatory requirements and prevent fraud.




How We Protect Your Information


  1. Data Encryption: All sensitive data is encrypted during transmission using SSL.

  2. Access Control: Only authorized personnel have access to personal information.

  3. Secure Storage: Data is stored on secure servers with regular security updates.


Sharing Your Information

We do not sell, rent, or trade your personal data. However, we may share your information with:


  1. Service Providers:

    • Payment processors and hosting services that assist in delivering our platform.



  2. Legal Authorities:

    • When required by law or to protect our legal rights.




Your Rights


  1. Access and Update: You can view and update your personal information in your account settings.

  2. Request Deletion: You have the right to request deletion of your data by contacting us.

  3. Opt-Out: You can opt out of receiving promotional emails by clicking the “unsubscribe” link in our emails.


Cookies Policy

We use cookies to enhance your experience by:


  • Remembering your preferences.

  • Analyzing website traffic.
    You can manage your cookie preferences through your browser settings.


Third-Party Links

Our platform may contain links to third-party websites. We are not responsible for their privacy practices and recommend reviewing their privacy policies.


Policy Updates

We may update this Privacy Policy from time to time. Changes will be posted on this page, and the "Effective Date" will be updated. Please review the policy periodically.


Contact Us

If you have any questions or concerns about our Privacy Policy or how your data is handled, please contact us at:

Email: support@anyleson.comThank you for trusting Anyleson with your learning journey!