IP绑定网卡Mac地址 防止ARP攻击
ARP 欺骗攻击使得网络堵塞变慢,网页病毒木马猖狂。一个暂时有效的解决方法是在防火墙、路由器和客户机把IP与网卡Mac地址进行绑定,限制 ARP
欺骗。
把下面的代码保存为 .bat 后缀的文件,修改 [ip] [mac] (分别为代理的IP和网卡Mac地址),双击运行即可:
把下面的代码保存为 .bat 后缀的文件,修改 [ip] [mac] (分别为代理的IP和网卡Mac地址),双击运行即可:
@echo off
::读取本机Mac地址
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
::读取本机ip地址
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
::绑定本机IP地址和MAC地址
arp -d
arp -s %IP% %Mac%
arp -s [ip] [mac]
exit
::读取本机Mac地址
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
::读取本机ip地址
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
::绑定本机IP地址和MAC地址
arp -d
arp -s %IP% %Mac%
arp -s [ip] [mac]
exit