2013-01-06 09:53来源:武汉北大青鸟光谷校区作者:027hpit
1SP.NET采集例子 百度搜索K8机器人 抓取标题和链接 改下网址和正则 可以随便抓指定站或者加个多线程 再加上相关漏洞测试 就可以写个自动入侵网站的程序 下面是简单的例子
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
using System.Net;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string htmlcode = GetHTML("http://www.baidu.com/s?wd=K8%BB%FA%C6%F7%C8%CB");//K8机器人
Regex reg= new Regex(".+)。*target=\"_blank\">(?.+)");
MatchCollection ms = reg.Matches(htmlcode);
foreach (Match m in ms)
{
//this.Response.Write(m.Groups["k8url"]+" " + m.Groups["k8title"] + "
");
this.Response.Write("" + m.Groups["k8title"] + "
");
}
}
public string GetHTML(string url)
{
WebClient web = new WebClient();
byte[] buffer = web.DownloadData(url);
return Encoding.Default.GetString(buffer);
}
}
Copyright (c) 2006-2021 武汉宏鹏教育咨询有限公司 版权所有 All Rights Reserved.