3、response响应数据data解密----->AES解密
一、目标网址:https://fanyi.youdao.com/index.html#/
二、接口分析





1、sign值生成逻辑
// c.a为crypto加密模块,直接导包替换就好
function j(e) {
return c.a.createHash("md5").update(e.toString()).digest("hex")
}
function k(e, t) {
return j(`client=${u}&mysticTime=${e}&product=${d}&key=${t}`)
}
const o = (new Date).getTime();
let e = 'fsdsogkndfokasodnaso'
// sign值生成
// e为固定值
// o为时间戳
sign = k(o, e)2、整合封装代码
const Crypto = require("crypto");
const u = "fanyideskweb",
d = "webfanyi",
m = "client,mysticTime,product",
p = "1.0.0",
g = "web",
b = "fanyi.web",
A = 1,
h = 1,
f = 1,
v = "wifi",
O = 0;
function j(e) {
return Crypto.createHash("md5").update(e.toString()).digest("hex")
}
function k(e, t) {
return j(`client=${u}&mysticTime=${e}&product=${d}&key=${t}`)
}
function set\_post\_data(txt) {
const o = (new Date).getTime();
let e = 'fsdsogkndfokasodnaso'
return {
i: txt,
from: 'auto',
to: '',
dictResult: 'true',
keyid: 'webfanyi',
sign: k(o, e),
client: u,
product: d,
appVersion: p,
vendor: g,
pointParam: m,
mysticTime: o,
keyfrom: b,
mid: A,
screen: h,
model: f,
network: v,
abtest: O,
yduuid: "abcdefg"
}
}3、使用python调用验证请求
import requests
import execjs
cookies = {....}
headers = {
'Accept': 'application/json, text/plain, \*/\*',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://fanyi.youdao.com',
'Pragma': 'no-cache',
'Referer': 'https://fanyi.youdao.com/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
'sec-ch-ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
}
with open('./set\_post\_data.js', 'r', encoding='utf-8') as f:
set_post_data_code = f.read()
data = execjs.compile(set_post_data_code).call('set\_post\_data', txt)
response = requests.post('https:///webtranslate', headers=headers, cookies=cookies, data=data)
print(response.text)
三、数据解密


1、解密js分析
//解密分析
// c.a为crypto加密模块,直接导包替换就好
function y(e) {
return c.a.createHash("md5").update(e).digest()
}
R = (t,o,n)=>{
if (!t)
return null;
const a = e.alloc(16, y(o))
, i = e.alloc(16, y(n))
, r = c.a.createDecipheriv("aes-128-cbc", a, i);
let s = r.update(t, "base64", "utf-8");
return s += r.final("utf-8"),
s
}
// t为加密数据data
// o为key值
// n为iv值
// 固定值可写死
let o = "ydsecret://query/key/B\*RGygVywfNBwpmBaZg\*WT7SIOUP2T0C9WHMZN39j^DAdaZhAnxvGcCY6VYFwnHl";
// 固定值可写死
let n = "ydsecret://query/iv/C@lZe2YzHtZ2CYgaXKSVfsb7Y4QWHjITPPZ0nQp87fBeJ!Iv6v^6fvi2WN@bYpJ4";2、整合封装代码
const Crypto = require("crypto");
### 一、Python所有方向的学习路线
Python所有方向路线就是把Python常用的技术点做整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。
















