苏飞论坛

标题: 万能框架中取到的验证码POST提交时总是提示错误! [打印本页]

作者: whfengbin    时间: 2014-12-17 02:55
标题: 万能框架中取到的验证码POST提交时总是提示错误!
如题!


private void Form1_Load(object sender, EventArgs e)
        {
            item = new CsharpHttpHelper.HttpItem()
            {
                URL = "https://user.qunar.com/captcha/api/image?k={en7mni(z&p=ucenter_login&c=ef7d278eca6d25aa6aec7272d57f0a9a",
                Method = "get"
            };
            this.pictureBox1.Image = http.GetImage(item);
        }


作者: whfengbin    时间: 2014-12-17 05:17
刚发现!就是抓包的时候,重新加载下验证码!抓到包的验证码和显示的不同!显示出来的验证码无法登陆 !这是怎么回事呀!
作者: whfengbin    时间: 2014-12-17 06:57
对这块不太熟悉,我现在是想做一个登陆去哪网的客户端,方便订票!搞了两天也没搞定这个验证码的问题!看站长能不能帮我具体看看怎么回事!
登陆网址:user.qunar.com
用户名:rxletnm1524
密码:AAbb123456
作者: 站长苏飞    时间: 2014-12-17 08:13
加上Cookie就行了,获取和提交时都加上登录页面的Cookie
作者: whfengbin    时间: 2014-12-17 20:47
我试了!就是抓打开页面时的COOKIE 然后获取和添加时都加上了!还是提示验证码错误!
代码:
private void Form1_Load(object sender, EventArgs e)
        {
            item = new HttpHelper.HttpItem()
            {
                URL = "https://user.qunar.com/captcha/api/image?k={en7mni(z&p=ucenter_login&c=ef7d278eca6d25aa6aec7272d57f0a9a&t=1418819333206",
                Method = "get",
                Cookie = "QN25=fad2f7c1-ad8e-4159-be90-bca674cca3c7-9f992f90; _i=RBTjeSJWldRVcM0RinU5QsbzYeix; QN1=wKgZEFSRdsR6CijIUsnNAg==; csrfToken=ehrnTwRGVwAQGcCl5tzKc0uYm30Diyet; _vi=RbW5cX6R0UnR1HKndzYPH1uqYOcTEE3VWwopp82QRMyJX9agebSK6swYSEqHLA_8n6iPMGb-MBDFIjZEAWrrxwIUQA9I3h96sLmYgGDFaowAcxeeYnGmrZvatfC-R68BSr32epXBfJGVFGHnG5eYtKRZDmDbSb-uLH-VHvG2gPL8; JSESSIONID=A8BF7B47880CDF3D8C1FECE8AD830A97"
            };
            this.pictureBox1.Image = http.GetImage(item);
        }

item = new HttpHelper.HttpItem()
            {
                URL = "https://user.qunar.com/passport/loginx.jsp",
                Method = "post",
                Referer = "https://user.qunar.com/passport/login.jsp?ret=http%3A%2F%2Fuser.qunar.com%2Fuserinfo%2Findex.jsp",
                Accept = "application/json, text/javascript, */*; q=0.01",
                ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
                Host = "user.qunar.com",
                Cookie = "QN25=fad2f7c1-ad8e-4159-be90-bca674cca3c7-9f992f90; _i=RBTjeSJWldRVcM0RinU5QsbzYeix; QN1=wKgZEFSRdsR6CijIUsnNAg==; csrfToken=ehrnTwRGVwAQGcCl5tzKc0uYm30Diyet; _vi=RbW5cX6R0UnR1HKndzYPH1uqYOcTEE3VWwopp82QRMyJX9agebSK6swYSEqHLA_8n6iPMGb-MBDFIjZEAWrrxwIUQA9I3h96sLmYgGDFaowAcxeeYnGmrZvatfC-R68BSr32epXBfJGVFGHnG5eYtKRZDmDbSb-uLH-VHvG2gPL8; JSESSIONID=A8BF7B47880CDF3D8C1FECE8AD830A97; JSESSIONID=A8BF7B47880CDF3D8C1FECE8AD830A97",
                Postdata = "loginType=2&ret=http%3A%2F%2Fuser.qunar.com%2Fuserinfo%2Findex.jsp&username=rxletnm1524&password=AAbb123456&remember=0&vcode="+textBox2.Text.Trim()
            };
            result = http.GetHtml(item);
            this.textBox1.Text = result.Html;

能帮我看下吗?验证码也可以正常获取!但是就是无法登陆 !
作者: whfengbin    时间: 2014-12-17 20:48
我把POST抓包的cookie放上了!也还是不行!

作者: whfengbin    时间: 2014-12-17 20:51
这是登陆成功后的POST流
POST /passport/loginx.jsp HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: zh-cn
Referer: https://user.qunar.com/passport/ ... serinfo%2Findex.jsp
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C; .NET4.0E; Shuame)
Host: user.qunar.com
Content-Length: 125
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: QN25=c030fcf2-8448-4ca1-bece-7e453c70b1e0-9f992f90; _i=RBTjeSJWldRVcM0RinU5QsbzYeix; QN1=wKgZEFSRdsR6CijIUsnNAg==; csrfToken=ehrnTwRGVwAQGcCl5tzKc0uYm30Diyet; _vi=RbW5cX6R0UnR1HKndzYPH1uqYOcTEE3VWwopp82QRMyJX9agebSK6swYSEqHLA_8n6iPMGb-MBDFIjZEAWrrxwIUQA9I3h96sLmYgGDFaowAcxeeYnGmrZvatfC-R68BSr32epXBfJGVFGHnG5eYtKRZDmDbSb-uLH-VHvG2gPL8; JSESSIONID=A8BF7B47880CDF3D8C1FECE8AD830A97

loginType=0&ret=http%3A%2F%2Fuser.qunar.com%2Fuserinfo%2Findex.jsp&username=rxletnm1524&password=AAbb123456&remember=0&vcode=EE2E

这是返回的数据:
{"data":{"redirect":"http%3A%2F%2Fuser.qunar.com%2Fuserinfo%2Findex.jsp","result":true,"yahoo_email":false},"errcode":0,"ret":true,"ver":0}
作者: yaqian    时间: 2015-11-17 15:00
whfengbin 发表于 2014-12-17 20:51
这是登陆成功后的POST流
POST /passport/loginx.jsp HTTP/1.1
x-requested-with: XMLHttpRequest

我现在也遇到这个问题,想问下是怎么解决的呢?




欢迎光临 苏飞论坛 (http://www.sufeinet.com/) Powered by Discuz! X3.4