防arp欺骗的批处理 自动绑定网关的批处理
将下面的代码。保存为doarp.bat添加到自动运行即可。
下面附上详细的说明:
这段脚本是 反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加载到本机对应表.
相关推荐
Nexthop 2020-06-25
zhuyonge 2020-06-11
markingmac 2020-04-25
山兔与孟婆 2020-02-18
adc00 2019-12-28
dahege 2019-11-03
quanhaoH 2017-03-23
BearWow 2017-09-26
seacover 2011-04-18
Macan生活点滴 2010-08-19
KINGJENSEN 2010-06-08
hotermomo 2008-09-07
prophet00 2010-11-15
BingGoGo技术 2010-02-19
ooouuuooouuu 2019-07-01
远超的blog 2015-12-16