好友
阅读权限10
听众
最后登录1970-1-1
|
楼主|
zzyzy
发表于 2025-4-14 09:26
那可以试试hook XMLHttpRequest,(function hookXMLHttpRequest() {
// 备份一下原始open和send方法
const realOpen = XMLHttpRequest.prototype.open;
const realSend = XMLHttpRequest.prototype.send;
// 重写open方法
XMLHttpRequest.prototype.open = function (method, url) {
console.log('请求地址是:', url);
console.log('请求方法类型:', method);
// 检查 URL 中是否包含 key
if (url.includes('radio.key')) {
// debugger; // 触发断点
console.log('URL 包含 key,断点触发');
}
// 调用原始的open方法
realOpen.apply(this, arguments);
};
// 重写send方法
XMLHttpRequest.prototype.send = function (data) {
// 发送请求体参数
console.log('请求体:', data);
// 调用原始的send方法,并传入所有参数
realSend.apply(this, arguments);
// 监听请求状态变化
this.addEventListener('readystatechange', () => {
if (this.readyState === 4) {
// 请求完成后执行的代码
console.log('获取返回的全部数据:', this.responseText);
}
});
};
})();,在请求体做判断。 |
|