|
本帖最后由 幻雪丶逆时光 于 2015-2-4 17:12 编辑
因为前几个月腾讯的登录算法发生更改以至于 之前用的算法 登入失败!!(旧算法---MD5(MD5(密码)+验证码))
貌似在3月份左右? 或者更前? 这不不是重点,腾讯的 算法 更新为
这个js 在会用工具 的都可以查看到. 这里不做特别说明
下面 是介绍 飞哥 的HttpHelper 来post 登录腾讯 取得 cookic
---------------------------------------------------------------------------------我是分割线--------------------------------
首先得获取 验证码. 获取验证码必须附上 需要登陆的QQ号 qqName .取出 返回的cookie 是必须的 后面回使用到
(当然 腾讯也支持 自动推送验证码 一般格式是 <!XXX> 这个不需要输入 验证码 登录 也不再讲解范围)
[C#] 纯文本查看 复制代码 /// <summary>
/// 获取图片
/// </summary>
public Image Verify(string qqName, out string cookie)
{
item = new HttpItem()
{
URL = "http://captcha.pengyou.com/getimage?&uin=" + qqName + "&aid=15004601&0.11248807175794862",
Method = "GET",
Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*",
Encoding = "utf-8",
ContentType = "application/x-www-form-urlencoded",
UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2; Alexa Toolbar; mxie; .NET CLR 1.1.4322)",
ResultType = ResultType.Byte
};
HttpResult result = http.GetHtml(item);
cookie = result.Cookie;
return byteArrayToImage(result.ResultByte);//得到验证图片
}
下面进行POST 服务器 string cookie 这个参数 是刚才 得到的 验证码的参数
[C#] 纯文本查看 复制代码 public string Login(string qqName, string Password, string Verify,ref string cookie)
{
string str = string.Empty;
str += "u=" + qqName;
str += "&p=" + QQencryption.MD5_QQ_2_Encrypt(long.Parse(qqName),Password, Verify);
str += "&verifycode=" + Verify;
str += "&css=http://imgcache.qq.com/ptcss/b2/qzone/15000101/style.css";
str += "&mibao_css=m_qzone";
str += "&aid=15004601";
str += "&u1=" + System.Web.HttpUtility.UrlEncode("http://www.pengyou.com/index.php?mod=login2&act=qqlogin");
str += "&ptredirect=1";
str += "&h=1";
str += "&from_ui=1";
str += "&fp=loginerroralert";
str += "&ptlang=2052";
str += "&dumy=";
//str += "&login_sig=o2uGOggzs1ppeZD44BwmcEUGyAeC1ZwxDSY-7ftMXgAK10nFbk1cdPiOWBysOlzl";
str += "&action=1-8-14390";
str += "&g=1";
str += "&t=1";
item = new HttpItem()
{
URL = "http://ptlogin2.pengyou.com/login?"+str,
Method = "GET",
Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*",
Encoding = "utf-8",
ContentType = "application/x-www-form-urlencoded",
UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2; Alexa Toolbar; mxie; .NET CLR 1.1.4322)",
Cookie = cookie
};
item.Headersadd("Accept-Encoding", "gzip, deflate");
item.Headersadd("Accept-Language", "zh-CN");
HttpResult result = http.GetHtml(item);
cookie = result.Cookie;
return result.Html;
}
----------------------------------------------------------------------------------还是分割线
腾讯服务器应该返回
这样 只要 使用 第二次POST 的cookie 去GET 腾讯的网页 便可以了
另外 向飞哥申精!!!!
_________________________________________________________________
以下是DEMO
补充内容 (2013-6-21 22:41):
伪验证码腾讯推送,达到过验证码效果
http://www.sufeinet.com/thread-3818-1-1.html
_____________________________________
2015.02.04 GET"是否需要验证码" 腾讯已经更新有需要的自己抓包修改 |
|