僅供學習
一.登入入口的url
https://sso.toutiao.com/account_login/v2/
二.需要破解的提交引數
account
password
fp(后續驗證發現他不做校驗)
三.找到登入加密的js(在第二層)
function a(e) {
var t, r = [];
if (void 0 === e)
return "";
t = function(e) {
for (var t, r = e.toString(), n = [], i = 0; i < r.length; i++)
0 <= (t = r.charCodeAt(i)) && t <= 127 ? n.push(t) : 128 <= t && t <= 2047 ? (n.push(192 | 31 & t >> 6),
n.push(128 | 63 & t)) : (2048 <= t && t <= 55295 || 57344 <= t && t <= 65535) && (n.push(224 | 15 & t >> 12),
n.push(128 | 63 & t >> 6),
n.push(128 | 63 & t));
for (var a = 0; a < n.length; a++)
n[a] &= 255;
return n
}(e);
for (var n = 0, i = t.length; n < i; ++n)
r.push((5 ^ t[n]).toString(16));
return r.join("")
}
四.翻譯js為python
def jing_ri_tou_tiao_encrype(data):
ls = list(data.encode('utf8'))
new_list = []
[new_list.append(str(hex(5 ^ls[index]).replace('0x',''))) for index in range(len(data))]
datahttps://www.cnblogs.com/pythonywy/archive/2020/10/19/= ''.join(new_list)
return data
五.完善代碼
import requests
def jing_ri_tou_tiao_encrype(data):
ls = list(data.encode('utf8'))
new_list = []
[new_list.append(str(hex(5 ^ ls[index]).replace('0x', ''))) for index in range(len(data))]
datahttps://www.cnblogs.com/pythonywy/archive/2020/10/19/= ''.join(new_list)
return data
account = jing_ri_tou_tiao_encrype('+86手機號')
password = jing_ri_tou_tiao_encrype('密碼')
url = 'https://sso.toutiao.com/account_login/v2/'
data = https://www.cnblogs.com/pythonywy/archive/2020/10/19/{'aid': '1231',
'service': 'https://mp.toutiao.com/',
'account_sdk_source': 'sso',
'mix_mode': '1',
# 'fp': 'verify_kg910vw9_W2a6NlcX_GN0g_4WbF_8FAj_ovWxG4zUiTK2',
'account': account,
'password': password,
}
headers = {
'Referer': 'https://mp.toutiao.com/auth/page/login/?redirect_url=JTJG',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36'
}
res = requests.post(url, data=https://www.cnblogs.com/pythonywy/archive/2020/10/19/data, headers=headers)
print(res.json())
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/180084.html
標籤:其他
上一篇:注釋與變數
