tgjarwl的博客

道可道,非常道;名可名,非常名

记录生活,记录更好的自己。


js测试用例

Life

情绪只是一种对外表达想法的工具,应该驾驭,而不应被其左右

常见用例

进程创建

function process_create()
{
	var WSHShell = WScript.CreateObject("WScript.Shell");

	// IWshShell.Run
	WSHShell.Run("calc.exe");

	// IWshShell.Exec
	WSHShell.Exec("calc.exe");

	// IShellDispatch.ShellExecute
	var ShellApp = WScript.CreateObject("Shell.Application");
	ShellApp.ShellExecute("calc.exe");
}

写文件

function process_file()
{
	// _Stream.SaveToFile
	var bs = new ActiveXObject("ADODB.Stream");
	bs.Type = 1;
	bs.Open;
	bs.SaveToFile("1.db", 2);

	var fsObj = new ActiveXObject("Scripting.FileSystemObject");

	// IFileSystem.CreateTextFile
	fsObj.CreateTextFile("1.txt");

	// IFileSystem.OpenTextFile;
	fsObj.OpenTextFile("1.txt");

	// IFileSystem.CopyFile
	fsObj.CopyFile ("1.txt","2.txt");

	// IWshShell.CreateShortcut
	var WshShell = new ActiveXObject("WScript.Shell");
	WshShell.CreateShortcut ("$home\desktop\DemoShortcut.lnk");

}

注册表

function process_reg()
{
	// IWshShell.RegWrite
	var WSHShell = new ActiveXObject("WScript.Shell");
	WSHShell.RegWrite("HKCU\Delete\Key", "test", "REG_SZ");
}

网络

function process_net()
{
	var objWinHttp = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
	var URL = "http://mail.baidu.com/file/pay/typeword13.doc"
	objWinHttp.Open("GET", URL, 0)

	var xHttp = new ActiveXObject("Microsoft.XMLHTTP");
	xHttp.Open ("Get", "http://www.baidu.com", 0);
}