制作内幕 游戏 网站 图标 | 理论 图标在线制作 | 看图软件 访谈活动 | 教程 技术 万年历
当前位置:首页>CG 教 程>网站开发>ASP.NET>

相关文章

推荐文章

     

热门文章

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

作者:CG谷 出处: 发布时间:2006-07-11 字体: [ ]

豆腐制作 都是精品
http://www.asp888.net 豆腐技术站

前面讲过很多的用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>


↑返回顶部   打印本页   关闭窗口↓  
收藏本文到:天极网摘 新浪VIVI 和讯网摘 博彩中心 365Key网摘 poco网摘 狐摘
亿友响享Yeeyoo igooi-it网摘 5seek网摘 I2Key 我摘网摘 天下图摘 YouNote 百特门
用户名: 新注册) 密码: 匿名评论 [所有评论]
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
设计服务 | 广告投放 | 友情链接 | 关于本站 | 联系我们 | 版权声明 | 设为首页 | 加入收藏