防arp欺骗的批处理 自动绑定网关的批处理
程序员文章站
2022-09-02 13:42:36
将下面的代码。保存为doarp.bat添加到自动运行即可。复制代码 代码如下:@echo off if %~n0==arp exit if %~n0==arp exit i...
将下面的代码。保存为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加载到本机对应表.
上一篇: js推箱子小游戏步骤代码解析
下一篇: 详解php中的类与对象(继承)