文件名称:静态IP网关双重绑定
文件大小:103KB
文件格式:EXE
更新时间:2012-01-30 09:29:36
ARP
城市热点公司的用户认证程序 源代码: @echo off title arp网关双重绑定 %date% %time% 李乐军编写 &color e5 arp -d echo =============================== ______________________________________ echo 网关双重绑定 注意:只有客户端登陆成功,即获得IP可 echo ---李乐军 以连接互联网后才有效 echo =============================== ______________________________________ :execute echo 正在测量是否登陆,请稍后... ping 202.201.166.188>baidu.txt for /f "tokens=4" %%i in (baidu.txt) do set var=%%i &if %%i==not goto notloaded find " Packets" baidu.txt >link.txt for /f "skip=2 tokens=10,11" %%i in (link.txt) do set lost=%%i &set loss=%%j &echo 包丢失率为%%j) if %lost%==0 goto right if %lost%==1 goto right if %lost%==2 goto right if %lost%==3 goto right if %lost%==4 goto notlinked :right echo =============================== echo 连接成功,正在进行绑定... ipconfig/all>ipconfig.txt find "Physical Address" ipconfig.txt >phyaddr.txt for /f "skip=2 delims=: tokens=2" %%i in (phyaddr.txt) do set phyaddr=%%i&echo 本地物理地址为%%i find " IP Address" ipconfig.txt >ipaddr.txt for /f "skip=2 delims=: tokens=2" %%i in (ipaddr.txt) do set ipaddr=%%i&echo 本地ip地址为%%i find "Default Gateway" ipconfig.txt >gateipaddr.txt for /f "skip=2 delims=: tokens=2" %%i in (gateipaddr.txt) do set gateipaddr=%%i&echo 网关ip地址为%%i arp -a>buffer.txt for /f "tokens=1,2 delims= " %%i in (buffer.txt) do ( if %%i==%gateipaddr% set gatephyaddr=%%j &echo 网关物理地址为%%j ) del ipconfig.txt del phyaddr.txt del ipaddr.txt del gateipaddr.txt del buffer.txt del baidu.txt del link.txt arp -s %ipaddr% %phyaddr% arp -s %gateipaddr% %gatephyaddr% echo ============================== arp -a echo ============================== echo 绑定成功 goto over :notlinked del baidu.txt del link.txt echo =============================== echo 网络连接不成功,无法绑定 echo 请你登陆成功后重试 echo =============================== goto over :notloaded del baidu.txt echo =============================== echo 你还没有登陆,无法得到ip地址 echo 请你登陆成功后重试 echo =============================== :over echo 3秒后退出... ping -n 3 127.1>nul del "C:\Program Files\Internet Explorer\网关双重绑定.bat"