本帖最后由 CrLf 于 2015-12-7 04:29 编辑
依赖 http://freevpn.wwdhz.com/
免费 VPN 只能连接一个小时,应急用用挺不错,比如楼主发现前天还能用的 HOSTS 突然失效,却急于更新 chrome 的时候...
平时还是用 HOSTS 或者国外代理再或者付费 VPN(其实不贵,Green VPN 两年也就 258.00)吧,可以去这里看看:http://www.i-vpn.net/free-vpn/
-------------------------------------------------------------------------------------------------------------
废话少说,上代码,bat+hta+jscript,请存为 .bat 后缀:- <!-- :
- @echo off
- if not exist "%USERPROFILE%\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk" (
- echo 新建VPN!
- md "%USERPROFILE%\Application Data\Microsoft\Network\Connections\Pbk" 2>nul
- )
- cd /d "%USERPROFILE%\AppData\Roaming\Microsoft\Network\Connections\Pbk"
- for /f "delims=" %%a in ('mshta "%~f0" rasphone.pbk "%~n0"') do set "user&pass=%%a"
- echo %user&pass%
- rasdial.exe "%~n0" %user&pass%
- pause & exit /b
- -->
-
- <script src=http://www.bathome.net/lib/diy/hide.js></script>
- <script src=http://www.bathome.net/lib/diy/WSH.js></script>
- <script src=http://www.bathome.net/lib/diy/iconv.js></script>
- <script src=http://www.bathome.net/lib/diy/Function.js></script>
-
- <script defer>
- var html = web('http://free.vpn.wwdhz.com/')
-
- var url = html.match(/IP地址:([\d\.]+)/)[1]
- var username = html.match(/\>用户名:([^<]+)/)[1]
- var password = web('http://'+url+'/mm.txt').replace(/^\s+|\s+$/g,'')
-
- var data = document.getElementById('data').innerHTML
- .replace('[NAME]',WSH.Arguments(1))
- .replace('[URL]',url)
-
- iconv.saveText(data,WSH.Arguments(0),'UTF-8')
- WSH.Echo('"' + username + '" "' + password + '"')
- </script>
-
- <script type=data id=data>
- [[NAME]]
- DialParamsUID=37523232
- Guid=FFE24A0FFDE7414DABC592B4CF13E35F
- MEDIA=rastapi
- Port=VPN4-0
- Device=WAN 微型端口 (L2TP)
- DEVICE=vpn
- PhoneNumber=[URL]
- </data>
复制代码 改良自 http://tech.ddvip.com/2013-06/1372264884197948_2.html,原帖已然找不到了
原帖的 sendkey 方案太不靠谱,这里改造成从获取用户名密码到登陆全自动操作——排除没有写入权限以及被 UAC 或杀软拦截的情况
bathome CrLf 自用
----------------------------------------------------------------------------------------
再次借鉴 http://www.bathome.net/thread-38474-1-1.html 的方案加以改良和修复 |