防arp欺骗的批处理 自动绑定网关的批处理
时间:2021-07-15 09:31:43|栏目:DOS/BAT|点击: 次
将下面的代码。保存为doarp.bat添加到自动运行即可。
@echo OFF
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit
echo 正在获取本机信息.....
:IP
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
echo 正在获取网关信息.....
FOR /f "skip=17 tokens=13 usebackq " %%i in (`ipconfig /all`) do Set GateIP=%%i && GOTO GateMac
:GateMac
echo IP:%GateIP%
FOR /f "skip=3 tokens=2 usebackq " %%i in (`arp -a %GateIP%`) do Set GateMAC=%%i && GOTO Start
:Start
echo MAC:%GateMAC%
arp -d
arp -s %GateIP% %GateMAC%
echo 操作完成!!!
exit
下面附上详细的说明:
这段脚本是 反ARP攻击,手工添加本机ip、mac和网关ip、mac的程序
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit //判断如果已被感染退出
echo 正在获取本机信息.....
:IP
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
//如上面提示的,获取本机IP和mac. 其中arp -s %IP% %MAC% 为将本机ip/mac加入本机ip/mac对应表.
echo 正在获取网关信息.....
FOR /f "skip=17 tokens=13 usebackq " %%i in (`ipconfig /all`) do Set GateIP=%%i && GOTO GateMac
:GateMac
echo IP:%GateIP%
FOR /f "skip=3 tokens=2 usebackq " %%i in (`arp -a %GateIP%`) do Set GateMAC=%%i && GOTO Start
:Start
echo MAC:%GateMAC%
arp -d
arp -s %GateIP% %GateMAC%
//这段是获取网关的ip/mac地址,其中arp -s %GateIP% %GateMAC% 是将网关的ip和mac加载到本机对应表.
复制代码 代码如下:
@echo OFF
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit
echo 正在获取本机信息.....
:IP
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
echo 正在获取网关信息.....
FOR /f "skip=17 tokens=13 usebackq " %%i in (`ipconfig /all`) do Set GateIP=%%i && GOTO GateMac
:GateMac
echo IP:%GateIP%
FOR /f "skip=3 tokens=2 usebackq " %%i in (`arp -a %GateIP%`) do Set GateMAC=%%i && GOTO Start
:Start
echo MAC:%GateMAC%
arp -d
arp -s %GateIP% %GateMAC%
echo 操作完成!!!
exit
下面附上详细的说明:
这段脚本是 反ARP攻击,手工添加本机ip、mac和网关ip、mac的程序
if %~n0==arp exit
if %~n0==Arp exit
if %~n0==ARP exit //判断如果已被感染退出
echo 正在获取本机信息.....
:IP
FOR /f "skip=13 tokens=15 usebackq " %%i in (`ipconfig /all`) do Set IP=%%i && GOTO MAC
:MAC
echo IP:%IP%
FOR /f "skip=13 tokens=12 usebackq " %%i in (`ipconfig /all`) do Set MAC=%%i && GOTO GateIP
:GateIP
echo MAC:%MAC%
arp -s %IP% %MAC%
//如上面提示的,获取本机IP和mac. 其中arp -s %IP% %MAC% 为将本机ip/mac加入本机ip/mac对应表.
echo 正在获取网关信息.....
FOR /f "skip=17 tokens=13 usebackq " %%i in (`ipconfig /all`) do Set GateIP=%%i && GOTO GateMac
:GateMac
echo IP:%GateIP%
FOR /f "skip=3 tokens=2 usebackq " %%i in (`arp -a %GateIP%`) do Set GateMAC=%%i && GOTO Start
:Start
echo MAC:%GateMAC%
arp -d
arp -s %GateIP% %GateMAC%
//这段是获取网关的ip/mac地址,其中arp -s %GateIP% %GateMAC% 是将网关的ip和mac加载到本机对应表.
上一篇:批处理BAT替换与截取字符串的用法t1=%a:~3%是什么意思
栏 目:DOS/BAT
下一篇:Convert 将 FAT 和 FAT32 卷转换为 NTFS
本文地址:http://www.codeinn.net/misctech/157670.html