明辉手游网中心:是一个免费提供流行视频软件教程、在线学习分享的学习平台!

arp -s静态绑定脚本

[摘要]Set objShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.F...

Set objShell = CreateObject("WScript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.CreateTextFile("temp.bat")

Set objReg = New RegExp

strMacPattern = "((\d ([a-f] [A-F])){2}-){5}(\d ([a-f] [A-F])){2}"

strIPPattern = "((2[0-4]\d 25[0-5] 1?\d?\d)\.){3}(2[0-4]\d 25[0-5] 1?\d?\d)"

Set objExec = objShell.Exec("arp -a")

Do

        strTemp = objExec.StdOut.ReadLine

        objReg.Pattern = strMacPattern

        Set arrMac = objReg.Execute(strTemp)

        objReg.Pattern = strIPPattern

        Set arrIP = objReg.Execute(strTemp)

        For Each strMac In arrMac

                For Each strIP In arrIP

                        objFile.WriteLine "arp -s " & strIP & " " & strMac

                Next

        Next

Loop Until objExec.StdOut.AtEndOfStream

objFile.Close

strScriptPath = Replace(WScript.ScriptFullName,WScript.ScriptName,"")

Set objExec = objShell.Exec(strScriptPath & "temp.bat")

Do While objExec.Status = 0

        WScript.Sleep 1000

Loop

objFSO.DeleteFile strScriptPath & "temp.bat"

WScript.Echo "Done!"


上面是电脑上网安全的一些基础常识,学习了安全知识,几乎可以让你免费电脑中毒的烦扰。