vpn連接程序hta版實(shí)現(xiàn)代碼(修改)
來源:易賢網(wǎng) 閱讀:1392 次 日期:2014-08-12 16:46:31
溫馨提示:易賢網(wǎng)小編為您整理了“vpn連接程序hta版實(shí)現(xiàn)代碼(修改)”,方便廣大網(wǎng)友查閱!

代碼如下:

<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>當(dāng)前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 '先確定還沒有到達(dá)結(jié)尾的位置

Content = txt.ReadAll '讀取整個(gè)文件的數(shù)據(jù)

Lines = Replace(Content, vbCrlf, "<br>") '將文本內(nèi)分行字符vbCrlf換成HTML換行標(biāo)記"<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列表,一行一個(gè),可以在每行里加說明" & vbcrlf

msg = msg & "復(fù)制IP會(huì)自動(dòng)粘貼到ip框里,是否成功的話,請(qǐng)看ip顯示:" & vbcrlf

alert msg

end sub

</SCRIPT>

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:vpn連接程序hta版實(shí)現(xiàn)代碼(修改)
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國(guó)考·省考課程試聽報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)