How to use vbs to realize virtual host and domain name checking
This article mainly explains "how to use vbs to achieve virtual host and domain name search", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to use vbs to achieve virtual hosts and domain name search" bar!
If WScript.Arguments.Count 1 Then
WScript.Echo "Example: CScript" & WScript.ScriptName & "www.sohu.com"
WScript.Quit
End If
Url= "http://www.seologs.com/ip-domains.html?domainname="&WScript.Arguments(0)
Set oXMLHttpRequest = CreateObject ("Msxml2.XMLHTTP")
OXMLHttpRequest.Open "GET", url, False, False
OXMLHttpRequest.Send
Str=oXMLHttpRequest.ResponseText
Ipos=instr (str, "")
Ipend=instr (str, "")
Str=mid (str,ipos+19,ipend-ipos-139)
Str=Replace (str, ",")
Str=Replace (str, ",")
Str=Replace (str, ",")
Str=Replace (str, ",")
Str=Replace (str, ",")
Str=Replace (str, "Found", "Found")
Iposa=instr (str, "with")
Iposb=InStr (str, "1)")
Stra=mid (str,iposa,iposb-iposa)
Str=replace (str,stra, "lcx")
Str=replace (str, "lcx1)",
1) ")
'wscript.echo str
Set oXMLHttpRequest=Nothing
Set objExplorer = WScript.CreateObject ("InternetExplorer.Application")
ObjExplorer.Navigate "about:blank"
ObjExplorer.ToolBar = 0
ObjExplorer.StatusBar = 0
ObjExplorer.Visible = 1
ObjExplorer.height=600
ObjExplorer.width=500
ObjExplorer.left=400
ObjExplorer.resizable=0
ObjExplorer.Document.Body.InnerHTML = str
ObjExplorer.document.parentwindow.clipboardData.SetData "text", str
Set objExplorer=nothing
= = regular:
Msg= "Please enter the IP or domain name you want to query:"
IP=Inputbox (msg, "Domain query", "www.haiyangtop.net")
If IP = "" Then IP = "www.haiyangtop.net"
Url = "http://www.seologs.com/ip-domains.html?domainname="& IP &"
Body = getHTTPPage (url)
Set Re = New RegExp
Re.Pattern = "([\ s\ S] +)"
Set Matches = Re.Execute (Body)
If Matches.Count > 0 Then Body = Matches (0). Value
Set oXMLHttpRequest=Nothing
Set objExplorer = WScript.CreateObject ("InternetExplorer.Application")
ObjExplorer.Navigate "about:blank"
ObjExplorer.ToolBar = 0
ObjExplorer.StatusBar = 0
ObjExplorer.Visible = 1
ObjExplorer.height=300
ObjExplorer.width=400
ObjExplorer.left=400
ObjExplorer.resizable=0
ObjExplorer.Document.Body.InnerHTML = IP & Body
'objExplorer.document.parentwindow.clipboardData.SetData "text, IP & Body
Set objExplorer=nothing
'Functional area
Function getHTTPPage (Path)
T = GetBody (Path)
GetHTTPPage = BytesToBstr (t, "GB2312")
End Function
Function GetBody (url)
On Error Resume Next
Set Retrieval = CreateObject ("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, ","
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr (Body, Cset)
Dim objstream
Set objstream = CreateObject ("adodb.stream")
Objstream.Type = 1
Objstream.Mode = 3
Objstream.Open
Objstream.Write Body
Objstream.Position = 0
Objstream.Type = 2
Objstream.Charset = Cset
BytesToBstr = objstream.ReadText
Objstream.Close
Set objstream = Nothing
End Function
At this point, I believe you have a deeper understanding of "how to use vbs to achieve virtual hosting and domain name checking". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!