arp病毒 防止arp病毒的批处理
程序员文章站
2022-06-23 18:27:57
复制代码 代码如下:@echo off :::::::::::::::::::::::::::::::::::::::::::::::...
复制代码 代码如下:
@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::
: 本机以及网关ip和mac地址绑定批处理程序::
::::::::::::::::::::::::::::::::::::::::::::::::::::
arp -d
:::::::::读取本机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 -s %ip% %mac%
:::::::::读取网关地址
if exist gateip.txt del gateip.txt
find "default gateway" ipconfig.txt >gateip.txt
for /f "skip=2 tokens=13" %%g in (gateip.txt) do set gateip=%%g
:::::::::获取网关mac地址
ping 192.168.0.1 -n 1
:::::::::读取网关mac地址
if exist gatemac.txt del gatemac.txt
arp -a %gateip% >gatemac.txt
for /f "skip=3 tokens=2" %%h in (gatemac.txt) do set gatemac=%%h
:::::::::绑定网关mac和ip
arp -s %gateip% %gatemac%
del gateip.txt
del gatemac.txt
del ipaddr.txt
del ipconfig.txt
del phyaddr.txt
exit
上一篇: 批处理的"循环"效果脚本
下一篇: 进入dos的一个密码破解方法