现在遇到的问题是无法登陆到淘宝的页面,哪位大哥有源码,麻烦贴一下。跪谢
—-
参考
http://blog.163.com/swordsmanxb@126/blog/static/264963362009115104390/
—-
—-
—-
—-
我不喷,别人就不一定了,你能搞定新浪t登陆么,合作哈
—-
那个加密 我还是有的。 不过调的js。 winfrom用。
—-
我说淘宝登录太简单了。有人会喷我么。
我不喷,别人就不一定了,你能搞定新浪t登陆么,合作哈
那个加密 我还是有的。 不过调的js。 winfrom用。
除了用户名,密码,其它参数,好象有20多个,如何得到,我是从http://login.sina.com.cn/signup/signin.php?entry=sso开始的,新浪重定向了好多次,有form也不一定post,N次Get,
—-
哪里n次get了
首先一次get 然后就是post 然后 就get 就ok了撒
—-
哪里n次get了
首先一次get 然后就是post 然后 就get 就ok了撒
你抓包了没有
—-
哪里n次get了
首先一次get 然后就是post 然后 就get 就ok了撒你抓包了没有
这是我抓的包,点击登录后,共5次get,最后才post
—-
哪里n次get了
首先一次get 然后就是post 然后 就get 就ok了撒你抓包了没有
这是我抓的包,点击登录后,共5次get,最后才post
我只想说。 有简单接口不用。 为毛用复杂的接口
—-
破解他们的登陆请求协议 貌似不是我技能范围能做的
感觉网上查的 你能查到的时候 就已经不能用了
—- 40分
Base类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Drawing;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using Spider;
namespace SpiderLogic.Logic
{
public abstract class Base//:IBase
{
public virtual string _charset { get; set; }
public virtual BrowserExcutor excutor { get; set; }
public virtual MSScriptControl.ScriptControlClass msControl { get; set; }
public virtual bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
// trust any certificate!!!
//System.Console.WriteLine(“Warning, trust any certificate”);
//为了通过证书验证,总是返回true
return true;
}
public virtual string Run(SpiderModel model)
{
return “没有实现代码”;
//throw new Exception(“没有实现”);
}
public virtual Bitmap GetCodeBitMap(SpiderModel model)
{
return null;
//throw new Exception(“没有验证码”);
}
public virtual CodeModel GetCode(SpiderModel model)
{
return null;
}
public virtual string GetLink(SpiderModel model)
{
return null;
}
}
}
Login.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Drawing;
using Spider;
namespace SpiderLogic.Logic
{
public class Login : Base
{
public string spm = “1.7274553.1997563269.1.”;
string umto = “”;
string gvfdcre = “”;
public Login()
{
_charset = “gbk”;
excutor = new Spider.BrowserExcutor(_charset);
ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate;
msControl = new MSScriptControl.ScriptControlClass();
msControl.Language = “javascript”;
spm = spm + RndNum(6);
}
public override string Run(SpiderModel model)
{
var mweb = PostData(model);
return mweb.result;
}
public virtual HttpWeb PostData(SpiderModel model)
{
HttpForm form = new HttpForm()
{
action = “https://login.taobao.com/member/login.jhtml”,
method = “post”,
referer = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”,
charset = _charset
};
form.AddFormControls(“TPL_username”, model.UserName);
form.AddFormControls(“TPL_password”, model.Password);
form.AddFormControls(“TPL_checkcode”, model.code);
form.AddFormControls(“need_check_code”, string.IsNullOrEmpty(model.code) ? “false” : “true”);
form.AddFormControls(“loginsite”, “0”);
form.AddFormControls(“newlogin”, “1”);
form.AddFormControls(“TPL_redirect_url”, “http://www.taobao.com/”);
form.AddFormControls(“from”, “tb”);
form.AddFormControls(“fc”, “default”);
form.AddFormControls(“style”, “default”);
form.AddFormControls(“css_style”, “”);
form.AddFormControls(“tid”, “XOR_1_000000000000000000000000000000_10504625460808700F030A71”);
form.AddFormControls(“support”, “000001”);
form.AddFormControls(“CtrlVersion”, “1,0,0,7”);
form.AddFormControls(“loginType”, “3”);
form.AddFormControls(“minititle”, “”);
form.AddFormControls(“minipara”, “”);
form.AddFormControls(“umto”, umto);
form.AddFormControls(“pstrong”, “3”);
form.AddFormControls(“llnick”, “”);
form.AddFormControls(“sign”, “”);
form.AddFormControls(“need_sign”, “”);
form.AddFormControls(“isIgnore”, “”);
form.AddFormControls(“full_redirect”, “”);
form.AddFormControls(“popid”, “”);
form.AddFormControls(“callback”, “1”);
form.AddFormControls(“guf”, “”);
form.AddFormControls(“not_duplite_str”, “”);
form.AddFormControls(“need_user_id”, “”);
form.AddFormControls(“poy”, “”);
form.AddFormControls(“gvfdcname”, “10”);
form.AddFormControls(“gvfdcre”, gvfdcre);
form.AddFormControls(“from_encoding”, “”);
form.AddFormControls(“sub”, “”);
form.AddFormControls(“allp”, “”);
form.AddFormControls(“oslanguage”, “zh-CN”);
form.AddFormControls(“sr”, “1920*1080”);
form.AddFormControls(“osVer”, “windows|5.2”);
form.AddFormControls(“naviVer”, “ie|6”);
//第一次登录
var mweb = excutor.OpenHtml(form, model.AllCookie);
var token = HtmlCollection.GetContent(mweb.result, “token\”:\””, “\””);
form = new HttpForm()
{
action = “https://passport.alipay.com/mini_apply_st.js?site=0&token=” + token + “&callback=vstCallback103”,
method = “get”,
referer = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”,
charset = _charset
};
//第二次登录
mweb = excutor.OpenHtml(form, model.AllCookie);
var st = HtmlCollection.GetContent(mweb.result, “st\”:\””, “\””);
form = new HttpForm()
{
action = “https://login.taobao.com/member/vst.htm?st=” + st + “¶ms=style%3Ddefault%26sub%3D%26TPL_username%3D” + model.UserName + “%26loginsite%3D0%26from_encoding%3D%26not_duplite_str%3D%26guf%3D%26full_redirect%3D%26isIgnore%3D%26need_sign%3D%26sign%3D%26from%3DtbTop%26TPL_redirect_url%3Dhttp%25253A%25252F%25252Fwww.taobao.com%25252F%26css_style%3D%26allp%3D&_ksTS=” + msControl.Eval(“new Date().getTime()”) + “_116&callback=jsonp117”,
method = “get”,
referer = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”,
charset = _charset
};
//第三次登录
mweb = excutor.OpenHtml(form, model.AllCookie);
var url = HtmlCollection.GetContent(mweb.result, “url\”:\””, “\””);
form = new HttpForm()
{
action = url,
method = “get”,
referer = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”,
charset = _charset
};
//第四次登录
mweb = excutor.OpenHtml(form, model.AllCookie);
return mweb;
}
public override Bitmap GetCodeBitMap(SpiderModel model)
{
HttpForm form = new HttpForm()
{
action = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”
};
var mweb = excutor.OpenHtml(form, model.AllCookie);
umto = HtmlCollection.GetContent(mweb.result, “name=\”umto\” value=\””, “\””);
gvfdcre = HtmlCollection.GetContent(mweb.result, “name=\”gvfdcre\” value=\””, “\””);
form = new HttpForm()
{
action = “https://login.taobao.com/member/request_nick_check.do?_input_charset=utf-8”,
method = “post”,
referer = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”,
charset = _charset
};
form.AddFormControls(“username”, model.UserName);
form.AddFormControls(“ua”, “”);
mweb = excutor.OpenHtml(form, model.AllCookie);
var url = HtmlCollection.GetContent(mweb.result, “url\”:\””, “\””);
form = new HttpForm()
{
action = url + “&_r_=” + msControl.Eval(“new Date().getTime()”),
referer = “https://login.taobao.com/member/login.jhtml?spm=” + spm + “&f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F”,
IsStream = true
};
mweb = excutor.OpenHtml(form, model.AllCookie);
Bitmap b = new Bitmap(mweb.stream);
return b;
}
public string RndNum(int VcodeNum)
{
string Drawchar = “0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z”; //存储用于验证的字符
string[] CharArr = Drawchar.Split(‘,’); //分割字符串存入数组
string RanChar = “”; //定义存储随机验证码
int Rndint; //定义存储随机数变量
Random Myran = new Random(); //初始化随机函数
for (int i = 0; i < VcodeNum; i++) //for语句
{
Rndint = Convert.ToInt16(Myran.Next(32)); //生成随机数
RanChar += CharArr[Rndint]; //生成字符串
}
return RanChar;
}
}
}