windows批处理命令实现MAC地址绑定
警告:运行BAT源码是一种危险的动作,如果你不熟悉,请不要尝试!ARP本机绑定这个功能就是获取当前的ip与网关的信息然后绑定防止内网ARP欺骗应该称为MAC绑定。
批处理代码如下:
@echo off
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist phyaddr.txt del phyaddr.txt
find "Physical Address" ipconfig.txt >phyaddr.txt
for /f "skip=2 tokens=12" %%M in (phyaddr.txt) do set Mac=%%M
if exist IPAddr.txt del IPaddr.txt
find "IP Address" ipconfig.txt >IPAddr.txt
for /f "skip=2 tokens=15" %%I in (IPAddr.txt) do set IP=%%I
arp -s %IP% %Mac%
del ipaddr.txt
del ipconfig.txt
del phyaddr.txt
exit
页:
[1]