python3今日头条头条登入加密破解
仅供学习
一.登入入口的url
https://sso.toutiao.com/account_login/v2/
二.需要破解的提交参数
accountpassword
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))]
data = "".join(new_list)
return data
五.完善代码
import requestsdef 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))]
data = "".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 = {
"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=data, headers=headers)
print(res.json())
以上是 python3今日头条头条登入加密破解 的全部内容, 来源链接: utcz.com/z/530684.html