www.pudn.com > TestToolsProject.rar > OpenPortSource.java, change:2014-02-11,size:4589b


package com.mervyn.testsource; 
 
import java.io.File; 
import java.io.IOException; 
 
import javax.swing.JOptionPane; 
 
import com.mervyn.testtools.TestToolsPing; 
 
public class OpenPortSource { 
	public void CreateCustomOpenPortSub() 
	{ 
		TestToolsPing GetMainSub=new TestToolsPing(); 
		String UpdateIP = JOptionPane.showInputDialog(null, 
				"请输入需要尝试批量开启23端口的IP地址:", "提示信息", JOptionPane.PLAIN_MESSAGE); 
		if(!UpdateIP.equals("")) 
		{ 
			try { 
				File directory = new File("."); 
				String FilePath = directory.getCanonicalPath() 
						+ "\\CustomOpen_PortSystem.vbs"; 
				GetMainSub.DeleteFileSub(FilePath); 
				String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
						+ "lj.run \"telnet "+UpdateIP+" 30462\" \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 \"sendcmd 1 DB set UserInfo 0 Password nE7jA{%}5m\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB set TelnetCfg 0 TS_Port 23\"\r\n" 
						+ "lj.sendkeys \"{enter}\"\r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"reboot\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.run \"telnet "+UpdateIP+" 43897\" \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 \"sendcmd 1 DB set UserInfo 0 Password nE7jA{%}5m\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB set TelnetCfg 0 TS_Port 23\"\r\n" 
						+ "lj.sendkeys \"{enter}\"\r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"reboot\" \r\n" 
						+ "lj.sendkeys \"{enter}\"\r\n" 
						+ "lj.run \"telnet "+UpdateIP+" 12167\" \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 \"sendcmd 1 DB set UserInfo 0 Password nE7jA{%}5m\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB set TelnetCfg 0 TS_Port 23\"\r\n" 
						+ "lj.sendkeys \"{enter}\"\r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"reboot\" \r\n" 
						+ "lj.sendkeys \"{enter}\"\r\n" 
						+ "lj.run \"telnet "+UpdateIP+" 58961\" \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 \"sendcmd 1 DB set UserInfo 0 Password nE7jA{%}5m\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB set TelnetCfg 0 TS_Port 23\"\r\n" 
						+ "lj.sendkeys \"{enter}\"\r\n" 
						+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
						+ "lj.sendkeys \"{enter}\" \r\n" 
						+ "lj.sendkeys \"reboot\" \r\n" 
						+ "lj.sendkeys \"{enter}\" "; 
				GetMainSub.CreateFile(FilePath, FileWriteStr); 
				Runtime.getRuntime().exec("cmd.exe /c start " + FilePath); 
 
			} catch (IOException e1) { 
				// TODO 自动生成 catch 块 
				e1.printStackTrace(); 
				JOptionPane.showMessageDialog(null, "程序异常!!", "错误信息", 
						JOptionPane.ERROR_MESSAGE); 
			} 
		} 
		else 
		{ 
			JOptionPane.showMessageDialog(null, "您输入的IP地址为空,无法找到该目标IP地址!!", "错误信息", 
					JOptionPane.ERROR_MESSAGE); 
		} 
		 
		 
	} 
	 
	 
}