明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

arp -s靜態(tài)綁定腳本

[摘要]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!"


上面是電腦上網(wǎng)安全的一些基礎(chǔ)常識(shí),學(xué)習(xí)了安全知識(shí),幾乎可以讓你免費(fèi)電腦中毒的煩擾。