In front of a lot of the use of asp+ to achieve the network long pursuit of the program, now here to provide you with this full application of the original program, I hope you first look at
The previous article, with the problem of taking a look at this program, in fact, is very simple. At the same time I also brought you the download of this program!
This program is still a little bit of a problem, such as processing IP address to find the host domain name, if the input is not a legitimate IP address, then the program will
Return an error, if you are interested, you can modify this program 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>"; Domain name converted to IP address
}
else{
Iphostentry hostinfo = DNS. GETHOSTBYADDR (Txtsearch.text);
strret= hostinfo.hostname + "<br>"; Convert IP address to 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 + "Agent Server:" + tcpconnect (tcpc,host,1080) + "<br>"; Ports used by the SOCKET5 port 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) {
The function of this function is to check whether the port of the specified host is in use.
String strret= "service not Found";
if (0 = = Tcpc. Connect (Host,port)) {
Connection Server succeeded
Strret= "is running";
}
return strret;
}
</script>
<title>web Hunt </title>
<script language= "JScript" >
These two functions are functional to access the Clipboard
function Doufucopy () {
TextRange = Txtsearch.createtextrange ();
Textrange.execcommand ("Copy");
}
function Doufupaste () {
TextRange = Txtsearch.createtextrange ();
Textrange.execcommand ("Paste");
}
-->
</SCRIPT>
<body>
<form Id=testform runat=server>
<asp:dropdownlist id= "DropDown1" runat= "Server" >
<asp:listitem id=listitem1 value=1> Find domain name </asp:ListItem>
<asp:listitem id=listitem2 value=2> Find ip</asp:listitem>
</asp:DropDownList>
<asp:textbox runat=server id=txtsearch/>
<br>
<asp:checkbox id= "CheckBox1" runat= "Server" text= "check each other's machine"/>
<br>
<asp:button runat=server id=do text= "Find" Onclick=doclick/>
</form>
<asp:label id=showmsg runat=server/>
<input Type=button value= "copy" onclick= "Doufucopy ();" >
<input Type=button value= "Paste" onclick= "doufucopy ();" >
</body>