D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
blackhat.pw
:
/
kunden
/
lib
/
susshi
/
exec
/
Filename :
wp-deploy-muplugin
back
Copy
#!/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;