标题 | vpn连接程序hta版实现代码(修改) |
范文 | 代码如下: <hta:application id=mysamplehta caption=yes scroll=auto border=none borderstyle=static singleinstance=yes maximizebutton=no border=no icon=dxdiag.exe> <title>vpn 连接程序 hta版</title> <style> body { font-size:12; background: #dadada; margin-left:5; } input { width:50; overflow:visible; border:1px solid lightblue; background-color:#cccccc; cursor:text; } button { border:1px solid gray; width:70; margin-left:2; cursor:hand; font-size:12; filter:progid:dximagetransform.microsoft.gradient(startcolorstr='#eaeaff', endcolorstr='#618fff', gradienttype='0'); } </style> <body> <input id=id size=30 value=mjj></input><br> <input id=pass size=30 value=mjj></input><br> <input id=ip size=50 value=vpn的ip ></input><br> <button id=ok onclick=vbs:conn>链接</button> <button id=nok onclick=vbs:dconn>断开</button> <button id=ipshow onclick=vbs:show>当前ip显示</button> <button id=vpnshow onclick=vbs:vpnshow>vpn列表</button> <button id=vpnhelp onclick=vbs:showhelp>帮助</button><br> <div id=url></div> </body> <script language=vbscript> set oshell = createobject(wscript.shell) sub window_onload window.resizeto 450,380 window.moveto 300, 300 copy end sub sub copy x(ip).value=me.clipboarddata.getdata(text) settimeout copy, 2000 end sub function x(obj) set x=document.getelementbyid(obj) end function sub dconn cmd=oshell.exec(rasdial /d).stdout.readall() x(url).innerhtml=cmd end sub sub show x(url).innerhtml= <br><br><iframe src=http://www.ip138.com/ip2city.asp></iframe> end sub sub conn tempfile=c:\tmp~386 if findfile(tempfile) = false then writef tempfile,x(ip).value x(url).innerhtml =create pbk file ........ok,连接中 else writef tempfile,x(ip).value x(url).innerhtml =pbk file 存在........ok,连接中 end if x(url).innerhtml= oshell.exec(rasdial pvpn &x(id).value& &x(pass).value& /phonebook:&tempfile).stdout.readall() end sub sub vpnshow set fso = createobject(scripting.filesystemobject) file = ip.txt set txt = fso.opentextfile(file) if not txt.atendofstream then '先确定还没有到达结尾的位置 content = txt.readall '读取整个文件的数据 lines = replace(content, vbcrlf, <br>) '将文本内分行字符vbcrlf换成html换行标记<br> x(url).innerhtml= lines end if end sub function findfile(str) set fso = createobject(scripting.filesystemobject) if fso.fileexists(str) then findfile=true else findfile=false end if end function function writef(pbk_file,ip) set fso = createobject(scripting.filesystemobject) with fso.opentextfile(pbk_file,2,true) .writeline [pvpn] .writeline encoding=1 .writeline type=2 .writeline autologon=0 .writeline userascredentials=1 .writeline dialparamsuid=546750 .writeline guid=76c5d8ff120c6a4f8e63f0b1e5d74ad4 .writeline baseprotocol=1 .writeline vpnstrategy=2 .writeline excludedprotocols=0 .writeline lcpextensions=1 .writeline dataencryption=8 .writeline swcompression=1 .writeline negotiatemultilinkalways=0 .writeline skipnwcwarning=0 .writeline skipdownleveldialog=0 .writeline skipdoubledialdialog=0 .writeline dialmode=1 .writeline dialpercent=75 .writeline dialseconds=120 .writeline hanguppercent=10 .writeline hangupseconds=120 .writeline overridepref=15 .writeline redialattempts=3 .writeline redialseconds=60 .writeline idledisconnectseconds=0 .writeline redialonlinkfailure=0 .writeline callbackmode=0 .writeline customdialdll= .writeline customdialfunc= .writeline customrasdialdll= .writeline authenticateserver=0 .writeline sharemsfileprint=1 .writeline bindmsnetclient=1 .writeline sharedphonenumbers=0 .writeline globaldevicesettings=0 .writeline prerequisiteentry= .writeline prerequisitepbk= .writeline preferredport=vpn4-0 .writeline preferreddevice=wan miniport (l2tp) .writeline preferredbps=0 .writeline preferredhwflow=1 .writeline preferredprotocol=1 .writeline preferredcompression=1 .writeline preferredspeaker=1 .writeline preferredmdmprotocol=0 .writeline previewuserpw=1 .writeline previewdomain=0 .writeline previewphonenumber=0 .writeline showdialingprogress=1 .writeline showmonitoriconintaskbar=1 .writeline customauthkey=-1 .writeline authrestrictions=608 .writeline typicalauth=2 .writeline ipprioritizeremote=1 .writeline ipheadercompression=0 .writeline ipaddress=0.0.0.0 .writeline ipdnsaddress=0.0.0.0 .writeline ipdns2address=0.0.0.0 .writeline ipwinsaddress=0.0.0.0 .writeline ipwins2address=0.0.0.0 .writeline ipassign=1 .writeline ipnameassign=1 .writeline ipframesize=1006 .writeline ipdnsflags=0 .writeline ipnbtflags=1 .writeline tcpwindowsize=0 .writeline useflags=0 .writeline ipsecflags=0 .writeline ipdnssuffix= .writeline .writeline netcomponents= .writeline ms_server=1 .writeline ms_msclient=1 .writeline ms_psched=1 .writeline .writeline media=rastapi .writeline port=vpn4-0 .writeline device=wan miniport (l2tp) .writeline .writeline device=vpn .writeline phonenumber=&x(ip).value .writeline areacode= .writeline countrycode=1 .writeline countryid=1 .writeline usedialingrules=0 .writeline comment= .writeline lastselectedphone=0 .writeline promotealternates=0 .writeline trynextalternateonfail=1 .writeline .close end with set fso = nothing end function sub showhelp msg = 在同目录下建立ip.txt & vbcrlf msg = msg & ------------------------------------------------ & vbcrlf msg = msg & ip.txt里是vpn的ip列表,一行一个,可以在每行里加说明 & vbcrlf msg = msg & 复制ip会自动粘贴到ip框里,是否成功的话,请看ip显示: & vbcrlf alert msg end sub </script> |
随便看 |
|
在线学习网范文大全提供好词好句、学习总结、工作总结、演讲稿等写作素材及范文模板,是学习及工作的有利工具。