搜索文章:

首页  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  VB编程

一个完整的网上追捕的原程序

前面讲过很多的用asp+实现网长追捕的程序,现在就在这里给大家提供这个完整应用的原程序,希望大家首先先看看 
以前的文章,带者问题来看这个程序,其实是很简单的。同时我也给大家带来了这个程序的下载! 
这个程序现在还是 有些 小问题,比如在 处理通过ip 地址查找 主机域名的时候,如果输入的不是合法的ip地址,则程序会 
返回一个错误,大家 如果有兴趣,可以自己修改修改这个程序的:) 
<%@ 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>"; //域名转换成ip地址 

else{ 
iphostentry hostinfo = dns.gethostbyaddr(txtsearch.text); 
strret= hostinfo.hostname + "<br>"; //ip地址转换成域名 


if(checkbox1.checked){ 
string host=txtsearch.text; 

tcpclient tcpc = new tcpclient(); 
strret=strret + "smtp server:" + tcpconnect(tcpc,host,25) + "<br>"; //smtp 端口 

tcpc = new tcpclient(); 
strret=strret + "www server:" + tcpconnect(tcpc,host,80) + "<br>"; //www 端口 

tcpc = new tcpclient(); 
strret=strret + "ftp server: " + tcpconnect(tcpc,host,21) + "<br>"; //ftp 端口 

tcpc = new tcpclient(); 
strret=strret + "pop3 server:" + tcpconnect(tcpc,host,110) + "<br>"; //pop 端口 

tcpc = new tcpclient(); 
strret=strret + "代理 server:" + tcpconnect(tcpc,host,1080) + "<br>"; //socket5 端口 代理服务器使用的端口 

tcpc = new tcpclient(); 
strret=strret + "dns server:" + tcpconnect(tcpc,host,53) + "<br>"; //dns 端口 

showmsg.text=strret; 


string tcpconnect(tcpclient tcpc,string host,int port){ 
//这个函数的功能是 检查 指定的 host 的 port 是否在用? 
string strret="服务没有找到"; 
if(0 == tcpc.connect(host,port)){ 
//联结服务器成功 
strret="正在运行"; 

return strret; 


</script> 
<html> 
<head> 
<title>web追捕</title> 
<script language="jscript"> 
//这两个函数是功能是对 剪贴板 进行存取 
function doufucopy() { 
textrange = txtsearch.createtextrange(); 
textrange.execcommand("copy"); 

function doufupaste() { 
textrange = txtsearch.createtextrange(); 
textrange.execcommand("paste"); 

--> 
</script> 
</head> 
<body> 
<form id=testform runat=server> 
<asp:dropdownlist id="dropdown1" runat="server"> 
<asp:listitem id=listitem1 value=1>查找域名</asp:listitem> 
<asp:listitem id=listitem2 value=2>查找ip</asp:listitem> 
</asp:dropdownlist> 
<asp:textbox runat=server id=txtsearch /> 
<br> 
<asp:checkbox id="checkbox1" runat="server" text="检查对方的机器" /> 
<br> 
<asp:button runat=server id=do text="查找" onclick=doclick /> 
</form> 
<asp:label id=showmsg runat=server /> 
<input type=button value="复制" onclick="doufucopy();"> 
<input type=button value="粘贴" onclick="doufucopy();"> 
</body> 
</html> 

()

下一篇:让Asp与XML交互 >>
相关文章:
© 2006   www.java-asp.net