web qq
- 检查登录状态
GET:
http://s.web2.qq.com/api/get_self_info2?t=1535906760478
返回:
{"retcode":0} 表示已登录
{"retcode":100101} 登录状态过期
- 获取登录二维码
- GET:
https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&APPid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginERRORalert&strong_login=1&login_state=10&t=20131024001
Cookies:{'pt_clientip': 'b0867167015c4d89', 'pt_login_sig': '4HK13eIvDKukz6asiRtvlHqc*WSmDlsAoGLUovq8AKFxg*m5kLJpXRp-luEKGySW', 'pt_serverip': '68626474160c148b', 'pt_user_id': '3292502229991558332', 'ptui_identifier': '000DC60CB8BFE02FFA2E37BBBCDBECC98523EBD3BF14839F77F15027'}
2. GET:
https://ssl.ptlogin2.qq.com/ptqrshow?appid=501004106&e=0&l=M&s=5&d=72&v=4&t=0.07461671762838862
得到一个二维码图片
Cookies:{'qrsig': 'pjk64jyvOvEatA0tULOBn5i9zEO7jYCPySKlPtWE5oMWVrPXgFdt8WMY*cq-i6qY'}
- 轮询检查是否扫码成功
GET:
https://ssl.ptlogin2.qq.com/ptqrlogin?ptqrtoken={ptqrtoken}&webqq_type=10&remember_uin=1&login2qq=1&aid=501004106&u1=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert&action=0-0-1625495.9193351606&mibao_css=m_webqq&t=undefined&g=1&js_type=0&js_ver=10141&login_sig={login_sign}&pt_randsalt=0
{
"Accept":"*/*",
"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0",
"content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
"referer":"https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1 &s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginerroralert &strong_login=1&login_state=10&t=20131024001"
}
参数:
login_sign :cookies["pt_login_sig"]
ptqrtoken :bknHash(cookies['qrsig'], init_str=0)
def bknHash(self,skey, init_str=5381):
hash_str = init_str
for i in skey:
hash_str += (hash_str << 5) + ord(i)
hash_str = int(hash_str & 2147483647)
return hash_str
响应:
当未扫描时 :ptuiCB('66','0','','0','二维码未失效。(4056963952)', '')
已扫描且确认:ptuiCB('0','0','http://ptlogin2.web2.qq.com/check_sig?pttype=1&uin=35946169&service=ptqrlogin&nodirect=0&ptsigx=11e3bd037d9ab1b3650d90335a66e7db32d3210049f1b060dab4de2a1154bc8574412099b5ada0abce9e6bfbe651a039fa463cad14934a0ad8d163296ec3af7a&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&f_url=&ptlang=2052&ptredirect=100&aid=501004106&daid=164&j_later=0&low_login_hour=0®master=0&pt_login_type=3&pt_aid=0&pt_aaid=16&pt_light=0&pt_3rd_aid=0','0','登 录成功!', 'メMoving。っ')
扫描成功并确认后,返回结果中的URL保存下来
3.GET 访问上一步获取到的URL,
http://ptlogin2.web2.qq.com/check_sig?pttype=1&uin=35946169&service=ptqrlogin&nodirect=0&ptsigx=11e3bd037d9ab1b3650d90335a66e7db32d3210049f1b060dab4de2a1154bc8574412099b5ada0abce9e6bfbe651a039fa463cad14934a0ad8d163296ec3af7a&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&f_url=&ptlang=2052&ptredirect=100&aid=501004106&daid=164&j_later=0&low_login_hour=0®master=0&pt_login_type=3&pt_aid=0&pt_aaid=16&pt_light=0&pt_3rd_aid=0
保存请求后返回的Cookies,后面用到
4.获取vfwebqq
GET:
http://s.web2.qq.com/api/getvfwebqq?ptwebqq={ptwebqq}&clientid=53999199&psessionid=&t=0.1
参数:
ptwebqq:cookies["ptwebqq"]
响应:
{'retcode': 0, 'result': {'vfwebqq': '49ffa4c595e289720dac8234db28bda95128e97c4fcca3303f65b00af39bd2bb7ef8df4f87cfcd5f'}}
5.第二次登录
POST:
http://d1.web2.qq.com/channel/login2
参数:
r='{"ptwebqq":"","clientid":53999199,"psessionid":"","status":"online"}'
r = r.encode('ISO-8859-1')
{ 'r': r }
cookies:
pgv_pvi = self.p('pgv_pvi')
pgv_pvi = pgv_pvi if pgv_pvi!='' else ctx.call('r')
cookies['pgv_si'] = pgv_si
cookies['pgv_pvi'] = pgv_pvi
cookies['pgv_info'] = 'ssid=pgv_pvid=1051433466'
def p(self,c):
cookies = self.cookies
result = cookies[c] if (c in cookies) else ''
return result
响应:
{"result":{"cip":23600812,"f":0,"index":1075,"port":47450,"psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133332e34312e383400001ad00000066b026e040015808a206d0000000a406172314338344a69526d0000002859185d94e66218548d1ecb1a12513c86126b3afb97a3c2955b1070324790733ddb059ab166de6857","status":"online","uin":35946169,"user_state":0,"vfwebqq":"59185d94e66218548d1ecb1a12513c86126b3afb97a3c2955b1070324790733ddb059ab166de6857"},"retcode":0}
至此,一个完整的登录流程完成。
后面再写如何接收信息、发送信息,敬请留意!!!
相关阅读
Swing实现登录页面,输入用户名和密码正确之后,点击确定按钮可以显示登录成功,输入错误会显示错误,点击重置按钮会将将用户名和密码清
淘宝(天猫)账户可以用密保手机号、密保邮箱以及淘宝会员名(用户名)和登录密码进行登录。其中以密保手机号登录的方式,可以自行开启
有些小伙伴问小编为什么手机淘工作登录不了的问题,小编于是整理了一些资料,希望给大家做一下说明,如果您感兴趣就来关注下小编为您总
1. 摘要 ( 注意:请仔细看下摘要,留心此文是否是您的菜,若浪费宝贵时间,深感歉意!!!) SSO这一概念由来已久,也是相当普遍的一种身份验证设
由于淘宝时刻都在对淘宝网上的卖家进行监管,很多卖家登录自己的账号时时常会碰到各种问题,有些朋友想问,账号被冻结了,会被限制登录吗