| Server IP : 208.122.213.31 / Your IP : 216.73.216.183 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/cms.classicscash.com/public_html/ |
Upload File : |
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
if ($ENV{'REMOTE_ADDR'} ne "216.127.32.37") {
print "Wrong IP: ".$ENV{'REMOTE_ADDR'}."\n";
exit;
}
if ($ENV{'REQUEST_METHOD'} ne "POST") {
print "Yup, Good Test.\n";
exit(1);
}
while(<STDIN>) {
$data .= $_;
}
if ( ($data =~ /^CHECK/) || ($data =~ /^DELETE/) ) {
($command, $ht_file, $user) = split(',',$data);
}
elsif ( $data =~ /^ADD/ ) {
($command, $ht_file, $user, $password) = split(',',$data);
}
elsif ( $data =~ /^BATCH/ ) {
($command, $ht_file, $users_pwds) = split('\+',$data);
@user_pwd_array = split(',',$users_pwds);
}
else {
print "COMMAND NOT RECOGNIZED\n";
exit(-1);
}
if ( $command =~ /CHECK/ || $command =~ /DELETE/ ) {
if ( -e $ht_file ) {
}
else {
print "\nERROR: password file not found: $ht_file\n";
exit(-1);
}
}
$rtn = system("cp $ht_file $ht_file.bak");
if ( $rtn != 0 ) {
print $! . " ERROR: Can't make backup of $ht_file - CHECK READ PERMISSIONS OF $ht_file AND WRITE PERMISSIONS OF THE DIRECTORY!!!";
}
if ( $debug == 1 ) { print "Made backup ht_file RTN:$rtn"; }
open(AC_FILE, "$ht_file") || die "ERROR - can't open $ht_file</body></html>"; # open for read
&read_lock('AC_FILE');
while (<AC_FILE>) {
chop($_);
($tmp_usr,$tmp_pwd) = split(/:/,$_);
if ( $tmp_usr eq "" ) { next; }
$users{$tmp_usr} = $tmp_pwd;
}
&clr_lock('AC_FILE');
close(AC_FILE);
if ($users{$user}) {
$found = 1;
}
else {
$found = 0;
}
if ( $debug ) { print "user_there_variable=$found\n"; }
if ( $command =~ /CHECK/ ) {
if ( $found ) { print "FOUND\n"; }
else { print "NOT_FOUND\n"; }
exit(0);
}
elsif ( $command =~ /ADD/ ) {
srand;
$salt = &to64(int(rand(2147483648)), 2);
$crypt_pwd = crypt($password, $salt);
$users{$user} = $crypt_pwd;
if ( $found ) {
if ( write_new() ) {
print "ADDED\n";
}
else {
print "ERROR\n";
}
}
else {
if ( !open(AC_FILE, ">>$ht_file") ) {
print "ERROR: can't open for writing/append ($ht_file) - check permissions";
exit(-1);
}
&write_lock('AC_FILE');
print AC_FILE "$user:$crypt_pwd\n";
flush('AC_FILE');
&clr_lock('AC_FILE');
close(AC_FILE);
print "ADDED\n";
}
exit(0);
}
elsif ( $command =~ /DELETE/ ) {
if ( $found ) {
delete $users{"$user"};
write_new();
}
print "DELETED $user\n";
exit(0);
}
elsif ( $command =~ /BATCH/ ) {
print "ADDING User/Pwds\n";
my $count = 0;
foreach $user_pwd (@user_pwd_array) {
++$count;
($user,$pwd) = split(':',$user_pwd);
srand;
$salt = &to64(int(rand(2147483648)), 2);
$crypt_pwd = crypt($pwd, $salt);
$users{$user} = $crypt_pwd;
}
print "WRITING $count Encrypted User/Pwds to file\n";
write_new();
print "DONE WITH BATCH ADD\n";
exit(0);
}
else {
print "COMMAND NOT RECOGNIZED\n";
exit(-1);
}
exit(0);
sub write_new() {
$file_string = "";
while (($user_temp,$pwd)=each(%users)) {
$file_string .= "$user_temp:$pwd\n";
}
if ( !open(AC_FILE, ">$ht_file") ) {
print "ERROR: can't open for writing/new ($ht_file) - check write permissions on this directory";
return(0);
}
&write_lock('AC_FILE');
print AC_FILE $file_string;
flush('AC_FILE');
&clr_lock('AC_FILE');
close(AC_FILE);
chmod 0666, $ht_file;
return(1);
}
sub flush {
local($old) = select(shift);
$| = 1;
print "";
$| = 0;
select($old);
}
sub LOCK_SH {1;}
sub LOCK_EX {2;}
sub LOCK_NB {4;}
sub LOCK_UN {8;}
sub read_lock {
local($rc,$fh);
$fh = shift;
$rc = flock($fh, &LOCK_SH());
return $rc;
}
sub write_lock {
local($rc,$fh);
$fh = shift;
$rc = flock($fh, &LOCK_EX());
return $rc;
}
sub clr_lock {
local($rc,$fh);
$fh = shift;
$rc = flock($fh, &LOCK_UN());
return $rc;
}
sub seedchar {
('a'..'z','A'..'Z','0'..'9','.','/')[rand(64)];
}
sub to64 {
$itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
local($v, $n) = @_;
local($s);
while (--$n >= 0) {
$s .= substr($itoa64, ($v % 64), 1);
$v >>= 6;
}
return $s;
}