1
0

fixed api_backupupload

This commit is contained in:
Mike Schwörer 2019-03-04 14:31:09 +01:00
parent 1253bb8aa1
commit 34ccf6633a

View File

@ -18,14 +18,18 @@ $putdata = fopen("php://input", "r");
$fp = tmpfile(); $fp = tmpfile();
$tmppath = stream_get_meta_data($fp)['uri']; $tmppath = stream_get_meta_data($fp)['uri'];
while ($data = fread($putdata, 1024)) fwrite($fp, $data); while ($data = fread($putdata, 1024)) fwrite($fp, $data);
fclose($fp);
fclose($putdata); fclose($putdata);
$std = shell_exec("sudo ncc_upload " . '"' . $tmppath . '" "' . $reltarget . '"'); // ncc_upload is allowed for all in /etc/sudoers $std = shell_exec("ncc_upload " . '"' . $tmppath . '" "' . $reltarget . '" 2>&1');
fclose($fp);
$content = "REQUEST: " . $uri . "\r\n\r\n" . $content = "REQUEST: " . $uri . "\r\n\r\n" .
"IP: " . get_client_ip() . "\r\n\r\n" . "IP: " . get_client_ip() . "\r\n\r\n" .
"TARGET: " . $reltarget . "\r\n\r\n" . "TARGET: " . $reltarget . "\r\n\r\n" .
"OUTPUT: " . $std . "\r\n\r\n"; "OUTPUT: " . $std . "\r\n\r\n";
sendMail("Fileupload to '$folder' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com'); sendMail("Fileupload to '$folder' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com');
echo "OK.\n\n";
echo $content;