实例介绍
【实例简介】测试结果:不能正常登陆了,不过可借鉴思路
【实例截图】
【核心代码】
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Threading; using System.Web; namespace QQWinFarm { public partial class FrmFarmLogin : Form { private System.Net.CookieContainer cookie = new System.Net.CookieContainer(); public FrmFarmLogin() { InitializeComponent(); } /// <summary> /// 获得验证码 /// </summary> private void GgetVerifyImage() { /* System.Drawing.Bitmap bmp = new Bitmap("d:\\getimage.jpg"); Verify asd = new Verify(bmp); asd.writetodata(); string asdasd = asd.ocrpic(); string asdasdasd = asd.getchar(); asd.bp.Save("d:\\1.jpg"); return;*/ // cookie = new System.Net.CookieContainer();// Stream s = HttpHelper.GetStream("http://ptlogin2.qq.com/getimage?aid=15000102&0.43878429697395826", cookie);//获取http流 if (s == null) { MessageBox.Show("外挂获取登录码错误,请检查您的网络!", "提示信息"); Application.ExitThread(); return; } picVerify.Image = Image.FromStream(s); s.Close(); // Stream geturlStream = } /// <summary> /// 登录 /// </summary> /// <returns></returns> public void Login() { this.Invoke((MethodInvoker)delegate { this.panel1.Enabled = false; }); ChangeMessage("正在登录..."); string username = txtQQ.Text; string userPWD = txtPwd.Text; string verifyCode = txtVerify.Text; string errorTxt = string.Empty; string strRetVal = Utils.getMd5Hash2(Utils.getMd5Hash(userPWD).ToUpper() verifyCode.ToUpper()).ToUpper(); //http://user.qzone.qq.com/726611131/infocenter#!app=353&url=http%3A%2F%2Fappbase.qzone.qq.com%2Fcgi-bin%2Findex%2Fappbase_run_unity.cgi%3Fappid%3D353%26max%3D0%26qz_height%3D600%26qz_width%3D760%26uin%3D726611131%26pfid%3D2%26qz_ver%3D6%26appcanvas%3D1%26qz_style%3Dv6%2F88%26params%3D%26entertime%3D1361008581358%26canvastype%3Dhome%26via%3DQZ.MYAPP string postData = "u=" username "&p=" strRetVal "&verifycode=" verifyCode "&aid=15000101&u1=http%3A%2F%2Fphp.qzone.qq.com%2Findex.php%3Fmod%3Dportal%26act%3Dlogin&fp=loginerroralert&h=1&ptredirect=1&ptlang=0&from_ui=1&dumy="; string result = HttpHelper.GetHtml("http://ptlogin2.qq.com/login", postData, true, cookie); errorTxt = result; result = HttpHelper.GetHtml("http://php.qzone.qq.com/index.php?mod=portal&act=login", cookie); bool isLogin = result.Contains("g_iLoginUin = " username); if (!isLogin) { if (result.Contains("完成跳转")) { ChangeMessage("登录成功"); isLogin = true; } else { if (!isLogin) { if (result.Contains("g_iLoginUin=" username)) { ChangeMessage("登录成功"); isLogin = true; } else { errorTxt = Utils.NoHTML(errorTxt); isLogin = false; } } } } else { ChangeMessage("登录成功"); isLogin = true; } if (isLogin) { this.Invoke((MethodInvoker)delegate { this.Hide(); FrmFarmMain fncm = new FrmFarmMain(cookie); fncm.Show(); }); } else { this.Invoke((MethodInvoker)delegate { this.Text = errorTxt; this.txtVerify.Text = ""; MessageBox.Show(errorTxt, "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Invoke((MethodInvoker)delegate { GgetVerifyImage(); this.panel1.Enabled = true; }); btnLogin.Text = "登录农场"; }); } } private void butVerify_Click(object sender, EventArgs e) { GgetVerifyImage(); } private void FrmFarmLogin_Load(object sender, EventArgs e) { // string asdasd = Utils.getMd5Hash2( Utils.getMd5Hash("wwgsxy1113616").ToUpper() "aaaa").ToUpper(); // txtVerify.Text = asdasd; //MessageBox.Show(Utils.ConvertUnicodeStringToChinese("\u5bd2\u51ac\u6765\u4e34\uff0c\u5316\u80a5\u4f9b\u5e94\u7d27\u5f20\uff0c\u76ee\u524d\u6682\u4e0d\u80fd\u8d2d\u4e70\u5316\u80a5")); GgetVerifyImage(); //int asd = HttpUtility.UrlDecode("274219550%2C314743076%2C513887433%2C393789055%2C412392567%2C383687343%2C31431996%2C501713534%2C19314415%2C375098725%2C1037203778%2C272859849%2C66004972%2C133739699%2C395992151%2C174835435%2C75969483%2C466204965%2C365438983%2C575725040%2C348702205%2C329212797%2C386502%2C360351087%2C410938863%2C124898421%2C7517580%2C455287740%2C609452359%2C903717240%2C97002056%2C154961405%2C443248871%2C969124263%2C715682588%2C8560603%2C498515796%2C25014960%2C417278600%2C269406025%2C413453284%2C381699117%2C328577997%2C305318274%2C383423659%2C475326534%2C376044211%2C76607710%2C87383945%2C444963071%2C361157088%2C278313539%2C413442668%2C20410072%2C490536895%2C165285884%2C964211902%2C417052854%2C605695880%2C29735047%2C670733745%2C278861593%2C215410799%2C289218276%2C514221404%2C472154432%2C513310345%2C541405851%2C81673444%2C44199900%2C545883436%2C776454115%2C664061745%2C835487407%2C646902904%2C835698093%2C380803259%2C303479625%2C350528899%2C153254306%2C501679211%2C527491998%2C364616956%2C670844696%2C937554000%2C285238133%2C53103685%2C412861427%2C182135110%2C454650002%2C517096970%2C308924269%2C415141491%2C377872441%2C717706704%2C43949192%2C77781076%2C294079209%2C554937993%2C517873235%2C380120552%2C505654082%2C19567788%2C382570409%2C461399307%2C281857874%2C736590981%2C31620490%2C850258302%2C441647027%2C729968820%2C522202610%2C1304619321%2C735137618%2C346821509%2C406653107%2C173470964%2C760231716%2C77052110%2C609846483%2C549541136%2C308926828%2C522951420%2C287070081%2C49743302%2C273821141%2C470542808%2C191310611%2C359358188%2C314595028%2C651998448%2C525753549%2C").Split(',').Length; } private void btnLogin_Click(object sender, EventArgs e) { Thread thread = new Thread(new ThreadStart(Login)); thread.IsBackground = true; thread.Start(); } private void ChangeMessage(string message) { this.Invoke((MethodInvoker)delegate { this.Text = message; }); } private void txtVerify_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Thread thread = new Thread(new ThreadStart(Login)); thread.IsBackground = true; thread.Start(); } } private void FrmFarmLogin_FormClosed(object sender, FormClosedEventArgs e) { Dispose(); System.Environment.Exit(System.Environment.ExitCode); } private void txtVerify_KeyPress(object sender, KeyPressEventArgs e) { char asdasd = e.KeyChar; if (asdasd == ',') { } } } }
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论