vbs获取本机外网ip
Function getmyip() Dim ie,regEx Set ie=CreateObject("internetexplorer.application") ie.navigate("http://www.ip138.com/ip2city.asp") ie.Visible=False While ie.busy Or ie.readystate <> 4 Wend Set regEx = New RegExp regEx.Pattern ="\d.*\d" Set Matches = regEx.Execute(ie.document.body.innerhtml) ie.Quit : Set ie=Nothing For Each Match in Matches getmyip=Match.Value Next End Function Function getmyip() Dim http,regEx Set http = CreateObject("WinHttp.WinHttpRequest.5.1") http.setTimeouts 10000, 10000, 10000, 10000 http.Open "get","http://www.ip138.com/ip2city.asp", False http.Send If http.Status="200" Then Set regEx = New RegExp regEx.Pattern ="\[(.*?)\]" Set Matches = regEx.Execute(http.ResponseText) For Each Match in Matches getmyip=Match.Submatches(0) Next End If Set http=Nothing End Function '另外再说下怎么使用wmi获取本地网卡信息 strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery( _ "SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=true and MACAddress<>''",,48) For Each objItem in colItems WScript.Echo objitem.IPAddress(0) 'IP地址 WScript.Echo objitem.IPSubnet(0) '子网掩码 WScript.Echo objitem.DNSServerSearchOrder(0) '默认DNS WScript.Echo objitem.DNSServerSearchOrder(1) '备用DNS WScript.Echo objitem.DefaultIPGateway(0) '网关 WScript.Echo objitem.DNSHostName '计算机名 WScript.Echo objitem.Description '网卡名字 WScript.Echo objitem.MACAddress 'MAC地址 next
在线ping将域名转换为IP地址
其实很简单,只需要一句代码,我想看得懂吧,使用方法 http://www.suntw.com/demo/domtoip.php?dom=www.163.com
<?echo gethostbyname( $_REQUEST['dom'] );?>
VBS修改本地网卡网络属性
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") Set colNetAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each objNetAdapter in colNetAdapters '更新IP地址和子网掩码 objNetAdapter.EnableStatic Array("192.168.0.252"), Array("255.255.255.0") '更新网关 objNetAdapter.SetGateways Array("192.168.0.1") '设置网关 '更新DNS配置 objNetAdapter.SetDNSServerSearchOrder Array("61.139.2.69","8.8.8.8") Next
关于CDN获取真实IP的办法
页码 1 / 11