复制代码 代码如下:
@echooff
::::::::::::::::::::::::::::::::::::::::::::::::::::
:本机以及网关IP和MAC地址绑定批处理程序::
::::::::::::::::::::::::::::::::::::::::::::::::::::
arp-d
:::::::::读取本机Mac地址
ifexistipconfig.txtdelipconfig.txt
ipconfig/all>ipconfig.txt
ifexistphyaddr.txtdelphyaddr.txt
find"PhysicalAddress"ipconfig.txt>phyaddr.txt
for/f"skip=2tokens=12"%%Min(phyaddr.txt)dosetMac=%%M
:::::::::读取本机ip地址
ifexistIPAddr.txtdelIPaddr.txt
find"IPAddress"ipconfig.txt>IPAddr.txt
for/f"skip=2tokens=15"%%Iin(IPAddr.txt)dosetIP=%%I
:::::::::绑定本机IP地址和MAC地址
arp-s%IP%%Mac%
:::::::::读取网关地址
ifexistGateIP.txtdelGateIP.txt
find"DefaultGateway"ipconfig.txt>GateIP.txt
for/f"skip=2tokens=13"%%Gin(GateIP.txt)dosetGateIP=%%G
:::::::::获取网关MAC地址
ping192.168.0.1-n1
:::::::::读取网关Mac地址
ifexistGateMac.txtdelGateMac.txt
arp-a%GateIP%>GateMac.txt
for/f"skip=3tokens=2"%%Hin(GateMac.txt)dosetGateMac=%%H
:::::::::绑定网关Mac和IP
arp-s%GateIP%%GateMac%
delGateIP.txt
delGateMac.txt
delIPAddr.txt
delipconfig.txt
delphyaddr.txt
exit
复制以上代码保存为bat文件.加载到启动项去,这样应该能防护到!