| Server IP : 217.160.0.214 / Your IP : 216.73.216.182 Web Server : Apache System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux User : ws67690508 ( 67690508) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/susshi/exec/ |
Upload File : |
#!/usr/bin/perl
use warnings;
use strict;
use lib '/usr/lib/susshi/exec';
use Susshi;
use File::Path qw( make_path );
use MIME::Base64;
my $susshi = Susshi->new( -read_input => 1 );
my $docroot = $susshi->get_directory( 'docroot', -mandatory => 1, -must_exist => 1 );
my $filename = $susshi->{filename} // '';
my $content = $susshi->{content} // '';
$filename or error_die "Missing 'filename' value";
$filename =~ /^[-_a-zA-Z0-9.]+$/ or error_die "filename does not pass check: $filename";
$filename =~ /\.\./ and error_die "filename does not pass check: $filename";
$content or error_die "Missing 'content' value";
my $decoded = decode_base64($content);
my $target_dir = "$docroot/wp-content/mu-plugins";
my $target_file = "$target_dir/$filename";
if (-d $target_dir) {
-o $target_dir or error_die "Owner of $target_dir is not $<";
} else {
eval { make_path($target_dir, { mode => 0755 }) };
error_die "make_path: $target_dir: $@" if $@;
}
open my $fh, '>', $target_file
or error_die "Cannot open $target_file: $!";
print $fh $decoded;
close $fh
or error_die "Cannot close $target_file: $!";
info("Wrote " . length($decoded) . " bytes to $target_file");
exit 0;