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

# cpanel - scripts/realadduser                     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

BEGIN {
    $ENV{'LANG'} = 'C';
}

use strict;
use Fcntl                       ();
use Cpanel::Finally             ();
use AcctLock                    ();
use Cpanel::Logger              ();
use Cpanel::LoginDefs           ();
use Cpanel::PwCache             ();
use Cpanel::SysAccounts         ();
use Whostmgr::Accounts::IdTrack ();

my $logger = Cpanel::Logger->new();

my $mailgid = ( Cpanel::PwCache::getpwnam('mail') )[3];

my $nochecks          = 0;
my $shell             = 0;
my $debug             = 0;
my $is_system_account = 0;

if (@ARGV) {
    while ( my $arg = shift @ARGV ) {
        last if !$arg;
        if ( $arg =~ m/^-+(\S+)/ ) {
            my $flag = $1;
            if ( $flag eq 'nochecks' ) {
                $nochecks = 1;
            }
            elsif ( $flag =~ m/^(no)?shell$/ ) {
                if ($1) {
                    $shell = 'noshell';
                }
                else {
                    $shell = shift @ARGV;
                }
            }
            elsif ( $flag =~ m/debug/i ) {
                $debug = 1;
            }
            elsif ( $flag eq 'r' || $flag eq 'system' ) {
                $is_system_account = 1;
            }
        }
        else {
            unshift @ARGV, $arg;
            last;
        }
    }
}

my $username = $ARGV[0];
my $homeroot = $ARGV[1];
my $pass     = $ARGV[2];
my $myuid    = $ARGV[3];
my $mygid    = $ARGV[4];

if ( !$ARGV[0] ) {
    my $up;
    chomp( $up = <STDIN> );
    my @UP = split( / /, $up );
    $username = $UP[0];
    $homeroot = $UP[1];
    $pass     = $UP[2];
}

if ( !$username ) {
    Cpanel::Logger::logger(
        {
            'message'   => "Syntax: adduser <username> <homeroot> <password>",
            'level'     => 'die',
            'service'   => 'realadduser',
            'output'    => 2,
            'backtrace' => 0,
        }
    );
}
if ( !$homeroot ) {
    Cpanel::Logger::logger(
        {
            'message'   => "Syntax: adduser <username> <homeroot> <password>",
            'level'     => 'die',
            'service'   => 'realadduser',
            'output'    => 2,
            'backtrace' => 0,
        }
    );
}

if ( !-e '/etc/allowstupidstuff' ) {
    if ( $username =~ /^\d+/ ) {
        Cpanel::Logger::logger(
            {
                'message'   => "Invalid username $username. Usernames must not begin with a number.",
                'level'     => 'die',
                'service'   => 'realadduser',
                'output'    => 2,
                'backtrace' => 0,
            }
        );
    }
}

if ( !$shell ) {
    if ( -x '/bin/rstsh' ) {
        $shell = '/bin/rstsh';
    }
    elsif ( -x '/bin/bash' ) {
        $shell = '/bin/bash';
    }
    elsif ( -x '/usr/local/bin/bash' ) {
        $shell = '/usr/local/bin/bash';
    }
    elsif ( -x '/bin/sh' ) {
        $shell = '/bin/sh';
    }
    else {
        Cpanel::Logger::logger(
            {
                'message'   => "No valid shell found. Using /bin/false",
                'level'     => 'warn',
                'service'   => 'realadduser',
                'output'    => 2,
                'backtrace' => 0,
            }
        );
        $shell = '/bin/false';
    }
}
elsif ( $shell eq 'noshell' ) {
    if ( -x '/usr/local/cpanel/bin/noshell' ) {
        $shell = '/usr/local/cpanel/bin/noshell';
    }
    else {
        $shell = '/bin/false';
    }
}

if ($debug) {
    Cpanel::Logger::logger(
        {
            'message'   => "User: $username Home: $homeroot Shell: $shell Checks: $nochecks",
            'level'     => 'debug',
            'service'   => 'realadduser',
            'output'    => 1,
            'backtrace' => 0,
        }
    );
    exit;
}

my $home = $homeroot;
if ( !-e $home ) {
    mkdir( $home, 0755 );
}

if ( $pass eq '' ) {
    Cpanel::Logger::logger(
        {
            'message'   => "No password specified for $username",
            'level'     => 'info',
            'service'   => 'realadduser',
            'output'    => 1,
            'backtrace' => 0,
        }
    );
}

my ( $minuid, $mingid, $maxuid, $maxgid );

if ($is_system_account) {
    $minuid = Cpanel::LoginDefs::get_sys_uid_min();
    $mingid = Cpanel::LoginDefs::get_sys_gid_min();
    $maxuid = Cpanel::LoginDefs::get_sys_uid_max();
    $maxgid = Cpanel::LoginDefs::get_sys_gid_max();
}
else {
    $minuid = Cpanel::LoginDefs::get_uid_min();
    $mingid = Cpanel::LoginDefs::get_gid_min();
    $maxuid = Cpanel::LoginDefs::get_uid_max();
    $maxgid = Cpanel::LoginDefs::get_gid_max();
}

my $username_nodash = $username;
if ( !$nochecks ) {
    $username_nodash =~ s/-//g;
}

my @UIDS;
my @GIDS;

AcctLock::acctlock();
my $unlock = Cpanel::Finally->new( sub { AcctLock::acctunlock(); } );

my ( $idalloc_status, $idalloc_statusmsg, $idalloc_uid, $idalloc_gid ) = Whostmgr::Accounts::IdTrack::allocate( { 'minuid' => $minuid, 'mingid' => $mingid } );

if ( !$idalloc_status ) {
    die $idalloc_statusmsg;
}

Cpanel::SysAccounts::add_system_user(
    $username,
    'pass'    => $pass,
    'uid'     => $idalloc_uid,
    'gid'     => $idalloc_gid,
    'homedir' => "$home/$username",
    'shell'   => $shell,
);

Cpanel::Logger::logger(
    {
        'message'   => "User $username added",
        'level'     => 'info',
        'service'   => 'realadduser',
        'output'    => 1,
        'backtrace' => 0,
    }
);

Youez - 2016 - github.com/yon3zu
LinuXploit