A complete online tracing process

Source: Internet
Author: User

Tofu is made of excellent products
Http://www.asp888.net bean curd technology station

I have mentioned a lot of programs that use asp + to achieve long network tracking. Now I will provide you with the original program for this complete application. I hope you will first take a look at it.
In previous articles, it was actually very simple to look at this program. At the same time, I also brought you the download of this program!
This program still has some minor problems. For example, if the Entered IP address is not a valid IP address, the program will
An error is returned. If you are interested, you can modify the program by yourself :)
<% @ Import NameSpace = "System. Net" %>
<% @ Import Namespace = "System. Net. Sockets" %>
<% @ Import Namespace = "System. IO" %>
<Script language = "C #" runat = server>
String strRet;
Protected void doClick (Object Src, EventArgs E ){

If (dropdown1.SelectedItem. Value. ToInt16 () = 2 ){

IPHostEntry hostInfo = DNS. GetHostByName (txtSearch. Text );
StrRet = hostInfo. AddressList [0]. ToString () + "<br>"; // convert the domain name to an IP address
}
Else {
IPHostEntry hostInfo = DNS. GetHostByAddr (txtSearch. Text );
StrRet = hostInfo. Hostname + "<br>"; // convert an IP address to a domain name
}

If (CheckBox1.Checked ){
String host = txtSearch. Text;

TCPClient tcpc = new TCPClient ();
StrRet = strRet + "SMTP Server:" + TcpConnect (tcpc, host, 25) + "<br>"; // SMTP Port

Tcpc = new TCPClient ();
StrRet = strRet + "WWW Server:" + TcpConnect (tcpc, host, 80) + "<br>"; // WWW Port

Tcpc = new TCPClient ();
StrRet = strRet + "FTP Server:" + TcpConnect (tcpc, host, 21) + "<br>"; // FTP port

Tcpc = new TCPClient ();
StrRet = strRet + "Pop3 Server:" + TcpConnect (tcpc, host, 110) + "<br>"; // Pop Port

Tcpc = new TCPClient ();
StrRet = strRet + "Proxy Server:" + TcpConnect (tcpc, host, 1080) + "<br>"; // Port 5 used by the Proxy Server

Tcpc = new TCPClient ();
StrRet = strRet + "DNS Server:" + TcpConnect (tcpc, host, 53) + "<br>"; // DNS port
}
Showmsg. Text = strRet;
}

String TcpConnect (TCPClient tcpc, String host, int port ){
// This function checks whether the port of the specified host is in use?
String strRet = "service not found ";
If (0 = tcpc. Connect (host, port )){
// The connection to the server is successful.
StrRet = "running ";
}
Return strRet;
}

</Script>
<Html>
<Head>
<Title> WEB tracking </title>
<Script language = "JScript">
// These two functions are used to access the clipboard.
Function doufucopy (){
TextRange = txtSearch. createTextRange ();
TextRange.exe cCommand ("Copy ");
}
Function doufupaste (){
TextRange = txtSearch. createTextRange ();
TextRange.exe cCommand ("Paste ");
}
-->
</SCRIPT>
</Head>
<Body>
<Form id = testForm runat = server>
<Asp: DropDownList id = "dropdown1" runat = "server">
<Asp: ListItem ID = ListItem1 Value = 1> Search for a domain name </asp: ListItem>
<Asp: ListItem ID = ListItem2 Value = 2> Search IP address </asp: ListItem>
</Asp: DropDownList>
<Asp: TextBox runat = server id = txtSearch/>
<Br>
<Asp: CheckBox id = "CheckBox1" runat = "server" Text = "Check the target machine"/>
<Br>
<Asp: Button runat = server id = do Text = "Search" onClick = doClick/>
</Form>
<Asp: Label id = showmsg runat = server/>
<Input type = button value = "copy" onclick = "doufucopy ();">
<Input type = button value = "Paste" onclick = "doufucopy ();">
</Body>
</Html>


Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.