网络相关

关注公众号 jb51net

关闭
实现ARP本机绑定的bat代码(MAC绑定)

实现ARP本机绑定的bat代码(MAC绑定)

热门排行

简介

ARP本机绑定这个功能就是获取当前的ip与网关的信息然后绑定防止内网ARP欺骗应该称为MAC绑定。

[code]
@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
[/code]

大家还下载了