www.pudn.com > TestToolsProject.rar > VbsExcuteSource.java, change:2014-07-19,size:14690b


package com.mervyn.testsource; 
 
import java.io.File; 
import java.io.IOException; 
import java.io.RandomAccessFile; 
 
import javax.swing.JOptionPane; 
 
public class VbsExcuteSource { 
	public String ResetTelecomadminPWSD(String Url,String User,String KeyID,String Port) { 
 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\")\r\n" 
				+ "lj.run \"telnet "+Url+" "+Port +"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \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}\" "; 
		return FileWriteStr; 
 
	} 
 
	public String QueryTelecomadminInfo(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB p UserInfo\" \r\n" 
				+ "lj.sendkeys \"{enter}\" "; 
		return FileWriteStr; 
 
	} 
 
	public String UpdateDeviceAreaCode(String UpdateAreaCode,String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\")\r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"upgradetest sdefconf " 
				+ UpdateAreaCode 
				+ "\"\r\n" + "lj.sendkeys \"{enter}\" \r\n"; 
		return FileWriteStr; 
	} 
 
	public String UpdateTelecomadminName(String NameValue,String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\")\r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB set UserInfo 0 Username " 
				+ NameValue 
				+ "\"\r\n" 
				+ "lj.sendkeys \"{enter}\" \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}\" "; 
		return FileWriteStr; 
	} 
	public String UpdateTelnetPasswd(String PasswordValue,String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\")\r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB set UserInfo 0 Username " 
				+ PasswordValue 
				+ "\"\r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
				+ "lj.sendkeys \"{enter}\" "; 
		return FileWriteStr; 
	} 
 
	public String initializeF460c220(String Url) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n " 
				+ "lj.run \"telnet "+Url+"\" \r\n " 
				+ "wscript.sleep 500 \r\n " 
				+ "lj.sendkeys \"twsz\" \r\n " 
				+ "lj.sendkeys \"{enter}\" \r\n " 
				+ "wscript.sleep 500 \r\n " 
				+ "lj.sendkeys \"twsz\" \r\n " 
				+ "lj.sendkeys \"{enter}\" \r\n " 
				+ "wscript.sleep 100 \r\n " 
				+ "lj.sendkeys \"loaddefaultconfig\" \r\n " 
				+ "lj.sendkeys \"{enter}\" \r\n " 
				+ "lj.sendkeys \"reboot\" \r\n " + "lj.sendkeys \"{enter}\" "; 
		return FileWriteStr; 
	} 
 
	public String ClearDeviceMACAddress(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n " 
				+ "lj.run \"telnet "+Url+"\" \r\n " 
				+ "wscript.sleep 500 \r\n " 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n " 
				+ "lj.sendkeys \"setmac 1 256 00:00:00:00:00:00\" \r\n " 
				+ "lj.sendkeys \"{enter}\" \r\n " 
				+ "wscript.sleep 100 \r\n " 
				+ "lj.sendkeys \"reboot\" \r\n " + "lj.sendkeys \"{enter}\" "; 
		return FileWriteStr; 
	} 
 
	public String CloseTelnetPort(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB set TelnetCfg 0 TS_Enable 0\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String CloseHTTPPort(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB set PortControl 0 PortEnable 0\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String SearchAreaCode(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"upgradetest gdefconf\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String SearchSoftwareVersion(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"cat /proc/csp/softVersion\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String SearchHardVersion(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"cat /proc/csp/hardVersion\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB save\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String ClearUserInformation(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"setmac 1 2180 ztepon\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"setmac 1 2193 0\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"rm -rf /userconfig/cfg/*\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"reboot\" \r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String RebootDevice(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet 192.168.1.1\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"sendcmd 1 DB reset\" \r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String SearchMacAddress(String SearchMacFlag,String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"setmac 2 "+SearchMacFlag+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
 
	public String ElectricLight(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"echo 1 > /proc/zteinfo/factory/factorymode\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"tso on 255\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "wscript.sleep 5000 \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \"tso off 255\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"echo 0 > /proc/zteinfo/factory/factorymode\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
 
	public String BlackOutLight(String Url,String User,String KeyID,String Port) { 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
				+ "lj.run \"telnet "+Url+"\" \r\n" 
				+ "wscript.sleep 500 \r\n" 
				+ "lj.sendkeys \""+User+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "lj.sendkeys \""+KeyID+"\" \r\n" 
				+ "lj.sendkeys \"{enter}\" \r\n" 
				+ "wscript.sleep 100 \r\n" 
				+ "lj.sendkeys \"tso off 255\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"echo 0 > /proc/zteinfo/factory/factorymode\" \r\n" 
				+ "lj.sendkeys \"{enter}\"\r\n" 
				+ "lj.sendkeys \"exit\"\r\n" 
				+ "lj.sendkeys \"{enter}\""; 
		return FileWriteStr; 
	} 
	public String TelephoneOutletFirstStartRingSource(String Url,String User,String KeyID,String Port) 
	{ 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
			+ "lj.run \"telnet "+Url+"\" \r\n" 
			+ "wscript.sleep 500 \r\n" 
			+ "lj.sendkeys \""+User+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \""+KeyID+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "wscript.sleep 100 \r\n" 
			+ "lj.sendkeys \"slctool startring 0 8100\" \r\n" 
			+ "lj.sendkeys \"{enter}\"\r\n" 
			+ "wscript.sleep 8000 \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \"slctool stopring 0\" \r\n" 
			+ "lj.sendkeys \"{enter}\"\r\n" 
			+ "lj.sendkeys \"exit\"\r\n" 
			+ "lj.sendkeys \"{enter}\""; 
	return FileWriteStr; 
	} 
	public String TelephoneOutletSecondStartRingSource(String Url,String User,String KeyID,String Port) 
	{ 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
			+ "lj.run \"telnet "+Url+"\" \r\n" 
			+ "wscript.sleep 500 \r\n" 
			+ "lj.sendkeys \""+User+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \""+KeyID+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "wscript.sleep 100 \r\n" 
			+ "lj.sendkeys \"slctool startring 1 8100\" \r\n" 
			+ "lj.sendkeys \"{enter}\"\r\n" 
			+ "wscript.sleep 8000 \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \"slctool stopring 1\" \r\n" 
			+ "lj.sendkeys \"{enter}\"\r\n"	 
			+ "lj.sendkeys \"exit\"\r\n" 
			+ "lj.sendkeys \"{enter}\""; 
	return FileWriteStr; 
	} 
	/*public String TelephoneOutletFirstStopRingSource(String Url,String User,String KeyID,String Port) 
	{ 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
			+ "lj.run \"telnet "+Url+"\" \r\n" 
			+ "wscript.sleep 500 \r\n" 
			+ "lj.sendkeys \""+User+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \""+KeyID+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "wscript.sleep 100 \r\n" 
			+ "lj.sendkeys \"slctool stopring 0\" \r\n" 
			+ "lj.sendkeys \"{enter}\"\r\n" 
			+ "lj.sendkeys \"exit\"\r\n" 
			+ "lj.sendkeys \"{enter}\""; 
	return FileWriteStr; 
	} 
	public String TelephoneOutletSecondStopRingSource(String Url,String User,String KeyID,String Port) 
	{ 
		String FileWriteStr = "set lj=wscript.createobject(\"wscript.shell\") \r\n" 
			+ "lj.run \"telnet "+Url+"\" \r\n" 
			+ "wscript.sleep 500 \r\n" 
			+ "lj.sendkeys \""+User+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "lj.sendkeys \""+KeyID+"\" \r\n" 
			+ "lj.sendkeys \"{enter}\" \r\n" 
			+ "wscript.sleep 100 \r\n" 
			+ "lj.sendkeys \"slctool stopring 1\" \r\n" 
			+ "lj.sendkeys \"{enter}\"\r\n" 
			+ "lj.sendkeys \"exit\"\r\n" 
			+ "lj.sendkeys \"{enter}\""; 
	return FileWriteStr; 
	}*/ 
 
}