有道翻译最新js逆向 前台识别
POST内容分析
我们需要获取翻译内容
首先F12查找network翻译时用到的传输内容和js文件
定位到请求网址为:”https://dict.youdao.com/webtranslate“
![](https://i-blog.csdnimg.cn/blog_migrate/34a28672f89ea24593225c58103c6b37.png)
同时发现 响应内容(包含我们需要的翻译结果)是加密的
![](https://i-blog.csdnimg.cn/blog_migrate/ab5d5d9fcaddf5cbb8c122db16e0d2cd.png)
js内容解析
POST-Request内容解析
查看荷载(Payload)有一下内容需要留意:signmysticTime
同时查看相关js文件,定位到app.fcc4646e.js
![](https://i-blog.csdnimg.cn/blog_migrate/9d2e3fe8630c612b85a4d2f3818be947.png)
在js文件中定位到Payload内容
![](https://i-blog.csdnimg.cn/blog_migrate/e7164babbc64b341782195b46db48978.png)
可以看到mysticTime js代码实现内容为const t = (new Date).getTime(); 这是一个时间戳
同时其他值固定且容易获取
![](https://i-blog.csdnimg.cn/blog_migrate/56b9b63622f27faa4758d669105f323c.png)
对sign进行分析,可以看到定义了b()函数而且使用了多函数引用
进行断点测试
![](https://i-blog.csdnimg.cn/blog_migrate/c5566ad69d107a13165208dee93ec9f6.png)
同时需要特别注意这段js代码
function b(e, t) {
return p(`client=${r}&mysticTime=${e}&product=${i}&key=${t}`)
}
在控制终端进行输出`client=${r}&mysticTime=${e}&product=${i}&key=${t}`查看
![](https://i-blog.csdnimg.cn/blog_migrate/8b3fdf5c644f1a8aaccb27c5ba05f0f6.png)
'client=fanyideskweb&mysticTime=fsdsogkndfokasodnaso&product=webfanyi&key=1672407825637'
目前看到key定义为了t函数,这个稍后可以使用代码实现
同时注意sign的加密函数构建:
function m(e) {
return c.a.createHash("md5").update(e).digest()
}
function p(e) {
return c.a.createHash("md5").update(e.toString()).digest("hex")
}
对sign进行对比:(可以使用firfox浏览器进行抓取,定位时间戳同时间段不容易发生变化,而Chrome浏览器会及时变化,对比不清晰)
![](https://i-blog.csdnimg.cn/blog_migrate/c176884c5ab7d8006a50372d496463d0.png)
![](https://i-blog.csdnimg.cn/blog_migrate/16f5da4e37000e270e128d984ce07b66.png)
POST内容获取代码编写
我们需要自己写代码来或者这几个值,以达到绕过Request识别
主要是进行sign和mysticTime值获取,我们对这段js代码进行处理和编写
function m(e) {
return crypto.createHash("md5").update(e).digest();
}
function p(e) {
return crypto.createHash("md5").update(e.toString()).digest("hex");
}
function b(e, t) {
return p(`client=${r}&mysticTime=${e}&product=${i}&key=${t}`);
}
function f(e) {
const t = Date.now();
return {
sign: b(t, e),
client: r,
product: i,
appVersion: l,
vendor: d,
pointParam: s,
mysticTime: t,
keyfrom: u,
};
}
编写后的输出
const r = "fanyideskweb";
const i = "webfanyi";
const l = "1.0.0";
const d = "web";
const s = "client,mysticTime,product";
const u = "fanyi.web";
const crypto = require("crypto");
function m(e) {
return crypto.createHash("md5").update(e).digest();
}
function p(e) {
return crypto.createHash("md5").update(e.toString()).digest("hex");
}
function b(e, t) {
return p(`client=${r}&mysticTime=${e}&product=${i}&key=${t}`);
}
function f(e) {
const t = Date.now();
return {
sign: b(t, e),
client: r,
product: i,
appVersion: l,
vendor: d,
pointParam: s,
mysticTime: t,
keyfrom: u,
};
}
const e = "fsdsogkndfokasodnaso";
const { sign, mysticTime } = f(e);
console.log(i);
console.log(sign);
console.log(r);
console.log(i);
console.log(l);
console.log(d);
console.log(s);
console.log(mysticTime);
console.log(u);
调试内容:
![](https://i-blog.csdnimg.cn/blog_migrate/b4070eebd2a7dfb131c73ebacc8363b1.png)
我们可以用python写一段输出
import hashlib
import time
def sign(r, i, e, t):
s = f"client={r}&mysticTime={t}&product={i}&key={e}"
h = hashlib.md5()
h.update(s.encode())
return h.hexdigest()
def get_sign(r, i, e):
t = int(time.time() * 1000)
return sign(r, i, e, t)
r = "fanyideskweb"
i = "webfanyi"
e = "fsdsogkndfokasodnaso"
sign = get_sign(r, i, e)
print(sign)
前端输出加密内容解密
先要查找到加密函数
![](https://i-blog.csdnimg.cn/blog_migrate/8cac96c2047f5a9b885285318b23d6a0.png)
查看定义栈
![](https://i-blog.csdnimg.cn/blog_migrate/b181b78705a1133b11b9f4f97300d1f6.png)
然后对输出的json内容进行解密就可以了