第三講 smart qq 登錄成功后獲取 vfwebqq ,psessionid,hash


 

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 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM