凝视天涧

全自动ARP实时绑定BAT文件

 

全自动ARP实时绑定BAT文件
说明一下,这个BVS脚本,它会每六秒钟清除一次ARP缓存。并绑定网关。真正做到了实时防护!

代码如下:请另存为.BAT文件.再运行一下,就可以了

path c:\;c:\windows;c:\windows\system32
c:
cd \
:::::::::读取本机Mac地址
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >c:\ipconfig.txt
:::::::::读取网关Mac地址
if exist GateMac.txt del GateMac.txt
arp -a %GateIP% >c:\GateMac.txt
for /f "skip=3 tokens=2" %%H in (GateMac.txt) do set GateMac=%%H
:::::::::读取网关地址
if exist GateIP.txt del GateIP.txt
find "Default Gateway" ipconfig.txt >c:\GateIP.txt
for /f "skip=2 tokens=13" %%G in (GateIP.txt) do set GateIP=%%G

echo set Ws = WScript.CreateObject("WScript.Shell") >c:\banding.vbs
echo count=0 >>banding.vbs
echo for each ps in getobject("winmgmts:\\.\root\cimv2:win32_process").instances_   >>banding.vbs
echo if ps.name="wscript.exe" then count=count+1   >>banding.vbs
echo next   >>banding.vbs
echo if count ^>^ 2 then wscript.quit   >>banding.vbs
echo i=1 >>banding.vbs
echo for i = 1 to 3 '3为绑定的次数   >>banding.vbs
echo i=i-1 '永远也不会是3,所以一直循环 >>banding.vbs
echo WScript.Sleep(1000*60*0.1) '每0.1分钟绑定一次   >>banding.vbs
echo ws.run "arp -d",0 >>banding.vbs
echo ws.run "arp -s %GateIP% %GateMac%",0 >>banding.vbs
echo next >>banding.vbs
c:
cd \
start banding.vbs
del /f /q GateMac.txt
del /f /q ipconfig.txt
del /f /q GateIP.txt
copy banding.vbs c:\windows\system32
echo Windows Registry Editor Version 5.00 >c:\arp.reg
echo. >>arp.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] >>arp.reg
echo "arptom"="c:\\windows\\system32\\banding.vbs" >>arp.reg
regedit -is arp.reg
del /f /q arp.reg
del /f /q banding.vbs
exit

posted on 2016-03-13 19:12  凝视天涧  阅读(755)  评论(0编辑  收藏  举报

导航