Running environment, NT (SERVER, WORKSTATION), W2K
WSH2.0 or later must be installed on the server
If WSH2.0 is not installed on your system, you can download it from the address below
Http://www.microsoft.com/msdownload/vbscript/scripting.asp
Contains WSH2.0
Below is the source code
<% @ Language = "VBScript" %>
<% Option Explicit %>
<%
If Request. Form ("frmHost") = "" Then
'Set the Initial Value
StrIP = Request. ServerVariables ("REMOTE_ADDR ")
Else
StrIP = Request. Form ("frmHost ")
End If
%>
<Html>
<Head>
<Title> DNS Lookup [V1.0] </title>
</Head>
<Body bgcolor = "# FFFFFF">
<Form Method = "POST" Name = "frmRDNS">
<Label for = "frmHost"> <u> Host: </u> </label>
<Input type = "text" name = "frmHost" ID = "frmHost"
Value = "<% = strIP %>">
<Input type = "button" name = "btnSubmit" ID = "btnSubmit"
Value = "Lookup" onClick = "document. frmRDNS. submit ()">
</Form>
<Font face = "arial" size = "2" color = "#003366">
<%
RMethod = uCase (Request. ServerVariables ("REQUEST_METHOD "))
If rMethod = "POST" Then
'Lookup Host
StrReturn = nsLookup (strIP)
If strReturn <> "" Then
Response. Write strReturn
Else
'A Lame Host is any Valid Host that DNS Cannot Resolve
'See InterNic for Details
Response. Write "<B> Lame Host-cocould Not Resolve DNS "_
& StrIP & "</B> <br>"
End If
End If
Function NSlookup (strHost)
'Create Shell Object
Set oShell = Server. CreateObject ("Wscript. Shell ")
'Run NSLookup via Command Prompt
'Dump Results into a temp text file
OShell. Run "% ComSpec %/c nslookup" & strHost _
& "> C: \" & strHost & ". txt", 0, True
'Open the temp Text File and Read out the Data
Set oFS = Server. CreateObject ("Scripting. FileSystemObject ")
Set oTF = oFS. OpenTextFile ("C: \" & strHost & ". txt ")
TempData = Null
Data = Null
I = 0
Do While Not oTF. AtEndOfStream
Data = Trim (oTF. Readline)
If I> 2 Then 'don' t want to display local DNS Info.
TempData = tempData & Data & "<BR>"
End If
I = (I + 1)
Loop
'Close it
OTF. Close
'Delete It
OFS. DeleteFile "C: \" & strHost & ". txt"
Set oFS = Nothing
NsLookup = tempData
End Function
%>
</Font>
</Body>
</Html>
The code is very simple. I will not talk much about it. If you have any questions about WSH, please download the Chinese version of WSH's electronic documentation. The CHINAASP Download Area will be available.
Hope to help you.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.