public static void Login_GetPHV()
???????{
???????????string urldata = "{\"ptwebqq\":\"#{ptwebqq}\",\"clientid\":53999199,\"psessionid\":\"\",\"status\":\"online\"}".Replace("#{ptwebqq}", Login_ptwebqq);
???????????urldata = "r=" + HttpUtility.UrlEncode(urldata);
???????????string dat = HTTP.Post("http://d1.web2.qq.com/channel/login2", urldata, "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2");
?????????
???????????Login_Psessionid = dat.Replace(":", ",").Replace("{", "").Replace("}", "").Replace("\"", "").Split(‘,‘)[10];
???????????Login_QQ = dat.Replace(":", ",").Replace("{", "").Replace("}", "").Replace("\"", "").Split(‘,‘)[14];//登录QQ
??????????//Login_Vfwebqq = dat.Replace(":", ",").Replace("{", "").Replace("}", "").Replace("\"", "").Split(‘,‘)[18];
???????????Login_Hash = Hash2(Login_QQ, Login_ptwebqq);// http://web2.qq.com/js/mq.js?t=20161220 ?在这个js 拿到那个hash的值 JS里面的方法名是Hash2 里面是16进制 需要转换成C#的类型。第一个参数是真实QQ第二个ptwebqq
???????????//一开始拿上面的cookie 里面的Vfwebqq,是不行的,再请求一遍,拿到获取好友信息的vfwebqq
???????????string urlvfwebqq = "http://s.web2.qq.com/api/getvfwebqq?ptwebqq=#{ptwebqq}&clientid=53999199&psessionid=&t=#{t}".Replace("#{ptwebqq}", Login_ptwebqq).Replace("#{t}", TimeStamp());
???????????string datVfwebqq = HTTP.Get(urlvfwebqq, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1");
???????????Login_Vfwebqq = datVfwebqq.Split(‘\"‘)[7];
???????????SendOnlog(Login_QQ ?+"/r/n"+ Login_Vfwebqq + "/r/n" + Login_Psessionid + "/r/n" + Login_Hash);
???????}
上面就可以拿到 Login_ptwebqq Login_Psessionid ,Login_Hash 这个hash 需要
http://web2.qq.com/js/mq.js?t=20161220 在这个js 拿到那个hash的值 JS里面的方法名是Hash2 里面是16进制 需要转换成C# 也可以直接 调用这个JS。第一个参数是Login_QQ 第二个Login_ptwebqq
public static string Hash2(string uin, string ptvfwebqq)
???????{
???????????int[] ptbIndex = new int[4];
???????????long QQ_Long = long.Parse(uin);
???????????for (int i = 0; i < ptvfwebqq.Length; i++)
???????????{
???????????????ptbIndex[i % 4] ^= ptvfwebqq.ToCharArray()[i];
???????????}
???????????string[] salt = { "EC", "OK" };
???????????long[] uinByte = new long[4];
???????????uinByte[0] = QQ_Long >> 24 & 255 ^ salt[0].ToCharArray()[0];
???????????uinByte[1] = QQ_Long >> 16 & 255 ^ salt[0].ToCharArray()[1];
???????????uinByte[2] = QQ_Long >> 8 & 255 ^ salt[1].ToCharArray()[0];
???????????uinByte[3] = QQ_Long & 255 ^ salt[1].ToCharArray()[1];
???????????long[] result = new long[8];
???????????for (int i = 0; i < 8; i++)
???????????{
???????????????result[i] = i % 2 == 0 ? ptbIndex[i >> 1] : uinByte[i >> 1];
???????????}
???????????string[] hex = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" };
???????????string buf = "";
???????????for (int i= 0; i < result.Length; i++)
???????????{
???????????????buf += hex[(int)((result[i] >> 4) & 15)];
???????????????buf += hex[(int)(result[i] & 15)];
???????????}
???????????return buf;
???????}
以上就是C# 获取smart qq 的vfwebqq ,psessionid,hash
第三讲 smart qq 登录成功后获取 vfwebqq ,psessionid,hash
原文地址:https://www.cnblogs.com/qizhuocai/p/9322632.html