域名注册查询系统
本代码主要是查询26个英文字母加10个数字组成的1到3位的.cn域名,可自行更改
查询较多时,请把超时时间设大一点。
大概思路就是这样的,还请高人完善一下。
1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Collections;
5
using System.Web;
6
using System.Web.Security;
7
using System.Web.UI;
8
using System.Web.UI.WebControls;
9
using System.Web.UI.WebControls.WebParts;
10
using System.Web.UI.HtmlControls;
11
using System.Net;
12
using System.Net.Sockets;
13
using System.Text;
14
using System.IO;
15
using log4net;
16
using ClassLibrary1;
17
18
public partial class post : System.Web.UI.Page
19
{
20
private const string CST_DEFAULT_ENCODEING = "GB2312";
21
protected void Page_Load(object sender, EventArgs e)
22
{
23
sentHttp();
24
}
25
private void sentHttp()
26
{
27
string result = "";
28
string[] temp = new string[]{"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o",
29
"p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9",""};
30
for (int i = 0; i < 36; i++)
31
{
32
for (int j = 0; j < 36; j++)
33
{
34
for (int l = 18; l < 36; l++)
35
{
36
result = GetWebPageString("http://panda.www.net.cn/cgi-bin/check_ac2.cgi?domain=" + temp[i]+temp[j]+temp[l] + ".cn");
37
if (result.Contains("|210|"))
38
{
39
Class1.writeLog(result);
40
}
41
}
42
}
43
}
44
}
45
46
47
/// <summary>
48
/// 使用Get方式得到数据
49
/// </summary>
50
/// <param name="URL">URL地址</param>
51
/// <returns>网页输出的内容</returns>
52
public static string GetWebPageString(string URL)
53
{
54
Stream data = null;
55
try
56
{
57
string str = "";
58
string sReturn = "";
59
// Get HTML data
60
WebClient client = new WebClient();
61
62
data = client.OpenRead(URL);
63
StreamReader reader = new StreamReader(data, System.Text.Encoding.GetEncoding(CST_DEFAULT_ENCODEING));
64
65
str = reader.ReadLine();
66
67
while (str != null)
68
{
69
sReturn += str;
70
str = reader.ReadLine();
71
}
72
return sReturn;
73
}
74
catch (Exception ex)
75
{
76
throw ex;
77
}
78
finally
79
{
80
if (data != null) data.Close();
81
}
82
}
83
}
84
using System;2
using System.Data;3
using System.Configuration;4
using System.Collections;5
using System.Web;6
using System.Web.Security;7
using System.Web.UI;8
using System.Web.UI.WebControls;9
using System.Web.UI.WebControls.WebParts;10
using System.Web.UI.HtmlControls;11
using System.Net;12
using System.Net.Sockets;13
using System.Text;14
using System.IO;15
using log4net;16
using ClassLibrary1;17

18
public partial class post : System.Web.UI.Page19
{20
private const string CST_DEFAULT_ENCODEING = "GB2312";21
protected void Page_Load(object sender, EventArgs e)22
{23
sentHttp();24
}25
private void sentHttp()26
{27
string result = "";28
string[] temp = new string[]{"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o",29
"p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9",""};30
for (int i = 0; i < 36; i++)31
{32
for (int j = 0; j < 36; j++)33
{34
for (int l = 18; l < 36; l++)35
{36
result = GetWebPageString("http://panda.www.net.cn/cgi-bin/check_ac2.cgi?domain=" + temp[i]+temp[j]+temp[l] + ".cn");37
if (result.Contains("|210|"))38
{ 39
Class1.writeLog(result);40
}41
}42
}43
}44
}45

46

47
/// <summary>48
/// 使用Get方式得到数据49
/// </summary>50
/// <param name="URL">URL地址</param>51
/// <returns>网页输出的内容</returns>52
public static string GetWebPageString(string URL)53
{54
Stream data = null;55
try56
{57
string str = "";58
string sReturn = "";59
// Get HTML data 60
WebClient client = new WebClient();61

62
data = client.OpenRead(URL);63
StreamReader reader = new StreamReader(data, System.Text.Encoding.GetEncoding(CST_DEFAULT_ENCODEING));64

65
str = reader.ReadLine();66

67
while (str != null)68
{69
sReturn += str;70
str = reader.ReadLine();71
}72
return sReturn;73
}74
catch (Exception ex)75
{76
throw ex;77
}78
finally79
{80
if (data != null) data.Close();81
}82
}83
}84



浙公网安备 33010602011771号