文本复制器
// ==UserScript== // @name PDD_100%稳定最终版_a_z_A_Z // @namespace http://tampermonkey.net/ // @version 2025-11-30 // @description You // @author You // @match https://mobile.yangkeduo.com/a* // @match https://mobile.yangkeduo.com/b* // @match https://mobile.yangkeduo.com/c* // @match https://mobile.yangkeduo.com/d* // @match https://mobile.yangkeduo.com/e* // @match https://mobile.yangkeduo.com/f* // @match https://mobile.yangkeduo.com/q* // @match https://mobile.yangkeduo.com/w* // @match https://mobile.yangkeduo.com/r* // @match https://mobile.yangkeduo.com/t* // @match https://mobile.yangkeduo.com/y* // @match https://mobile.yangkeduo.com/u* // @match https://mobile.yangkeduo.com/i* // @match https://mobile.yangkeduo.com/o* // @match https://mobile.yangkeduo.com/p* // @match https://mobile.yangkeduo.com/s* // @match https://mobile.yangkeduo.com/h* // @match https://mobile.yangkeduo.com/j* // @match https://mobile.yangkeduo.com/k* // @match https://mobile.yangkeduo.com/l* // @match https://mobile.yangkeduo.com/z* // @match https://mobile.yangkeduo.com/x* // @match https://mobile.yangkeduo.com/v* // @match https://mobile.yangkeduo.com/n* // @match https://mobile.yangkeduo.com/m* // @match https://mobile.yangkeduo.com/garden_* // @match https://mobile.yangkeduo.com/Q* // @match https://mobile.yangkeduo.com/W* // @match https://mobile.yangkeduo.com/E* // @match https://mobile.yangkeduo.com/R* // @match https://mobile.yangkeduo.com/T* // @match https://mobile.yangkeduo.com/Y* // @match https://mobile.yangkeduo.com/U* // @match https://mobile.yangkeduo.com/I* // @match https://mobile.yangkeduo.com/O* // @match https://mobile.yangkeduo.com/P* // @match https://mobile.yangkeduo.com/A* // @match https://mobile.yangkeduo.com/S* // @match https://mobile.yangkeduo.com/D* // @match https://mobile.yangkeduo.com/F* // @match https://mobile.yangkeduo.com/H* // @match https://mobile.yangkeduo.com/J* // @match https://mobile.yangkeduo.com/K* // @match https://mobile.yangkeduo.com/L* // @match https://mobile.yangkeduo.com/Z* // @match https://mobile.yangkeduo.com/X* // @match https://mobile.yangkeduo.com/C* // @match https://mobile.yangkeduo.com/V* // @match https://mobile.yangkeduo.com/B* // @match https://mobile.yangkeduo.com/N* // @match https://mobile.yangkeduo.com/M* // @connect www.ippost.cyou // @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.2.0/crypto-js.min.js // @grant GM_xmlhttpRequest // @run-at document-start // ==/UserScript== (function() { 'use strict'; const config = { apiKey: "pdd000233mfOAnR3-t8BzwrKchKNuiOb", // 32字节密钥(已验证) clientVersion: "2025-11-30", coreScriptUrl: "https://www.ippost.cyou/get_pdd_html_json.php", aesMode: CryptoJS.mode.CBC, aesPadding: CryptoJS.pad.Pkcs7, aesBlockSize: 16, aesKeySize: 32 }; const logger = { log: (msg) => console.log(`[PDD动态加载器] ${new Date().toISOString()} - ${msg}`), error: (msg) => console.error(`[PDD动态加载器 ERROR] ${new Date().toISOString()} - ${msg}`), debug: (msg) => console.debug(`[PDD动态加载器 DEBUG] ${new Date().toISOString()} - ${msg}`) }; function validateApiKey() { const keyBytes = CryptoJS.enc.Latin1.parse(config.apiKey); if (keyBytes.sigBytes !== config.aesKeySize) { const error = `密钥长度非法!AES-256要求32字节,当前密钥实际${keyBytes.sigBytes}字节`; logger.error(error); alert(error); return false; } logger.debug(`密钥校验通过(32字节原始二进制)`); return true; } function getUserAgentHash() { const ua = navigator.userAgent.trim(); const md5Hash = CryptoJS.MD5(ua).toString(); return md5Hash.substr(0, 16); } function aesEncrypt(plainText, key) { try { if (!validateApiKey()) return null; const keyHex = CryptoJS.enc.Latin1.parse(key); const iv = CryptoJS.lib.WordArray.random(config.aesBlockSize); const plainTextUtf8 = CryptoJS.enc.Utf8.parse(plainText.trim()); const encrypted = CryptoJS.AES.encrypt( plainTextUtf8, keyHex, { iv: iv, mode: config.aesMode, padding: config.aesPadding, format: CryptoJS.format.Raw, blockSize: config.aesBlockSize, keySize: config.aesKeySize / 4 } ); const cipherText = encrypted.ciphertext; if (cipherText.sigBytes % config.aesBlockSize !== 0) { throw new Error(`密文长度非法(${cipherText.sigBytes}字节,需为16的倍数)`); } logger.debug(`AES加密校验通过 - IV(Hex): ${iv.toString(CryptoJS.enc.Hex)} | 密文长度: ${cipherText.sigBytes}字节`); const combined = iv.concat(cipherText); let base64Str = CryptoJS.enc.Base64.stringify(combined).replace(/\s+/g, ''); return base64Str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); } catch (e) { logger.error(`AES加密失败: ${e.message}`); return null; } } function generateToken() { try { const timestamp = Math.floor(Date.now() / 1000); const uaHash = getUserAgentHash(); const tokenPlain = `${timestamp}|${uaHash}|${config.clientVersion}`; const token = aesEncrypt(tokenPlain, config.apiKey); if (token) { logger.log(`Token生成成功(明文: ${tokenPlain} | Token长度: ${token.length})`); return token; } throw new Error("Token加密后为空"); } catch (e) { logger.error(`Token生成失败: ${e.message}`); return null; } } function aesDecrypt(encryptedData, key) { try { if (!validateApiKey()) return null; encryptedData = encryptedData.trim().replace(/-/g, '+').replace(/_/g, '/'); const padLength = 4 - (encryptedData.length % 4); if (padLength < 4) encryptedData += '='.repeat(padLength); logger.debug(`还原Base64: ${encryptedData.substring(0, 30)}...(长度: ${encryptedData.length})`); const combined = CryptoJS.enc.Base64.parse(encryptedData); if (combined.sigBytes < config.aesBlockSize) { throw new Error(`Base64解析后长度不足(${combined.sigBytes}字节,需≥16)`); } logger.debug(`Base64解析成功 - 总长度: ${combined.sigBytes}字节`); const iv = CryptoJS.lib.WordArray.create(combined.words.slice(0, 4), config.aesBlockSize); const cipherTextBytes = combined.sigBytes - config.aesBlockSize; if (cipherTextBytes < config.aesBlockSize) { throw new Error(`密文长度不足(${cipherTextBytes}字节,需≥16)`); } const cipherText = CryptoJS.lib.WordArray.create(combined.words.slice(4), cipherTextBytes); if (cipherText.sigBytes % config.aesBlockSize !== 0) { throw new Error(`密文长度非法(${cipherText.sigBytes}字节,需为16的倍数)`); } logger.debug(`AES解密校验通过 - IV(Hex): ${iv.toString(CryptoJS.enc.Hex)} | 密文长度: ${cipherText.sigBytes}字节`); const keyHex = CryptoJS.enc.Latin1.parse(key); const decrypted = CryptoJS.AES.decrypt( { ciphertext: cipherText }, keyHex, { iv: iv, mode: config.aesMode, padding: config.aesPadding, blockSize: config.aesBlockSize, keySize: config.aesKeySize / 4 } ); const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8).trim(); if (!decryptedStr) throw new Error("解密结果为空"); logger.debug(`AES解密成功(明文长度: ${decryptedStr.length}字节)`); return decryptedStr; } catch (e) { logger.error(`AES解密失败: ${e.message}`); return null; } } function executeCoreScript(coreScript) { try { if (!window.pddCoreConfig || !window.pddCoreConfig.jsonSendConfig) { throw new Error("核心配置未初始化"); } const scriptTag = document.createElement("script"); scriptTag.textContent = coreScript; scriptTag.onload = () => { logger.log("✅ 核心脚本执行成功!"); console.log("PDD功能"); }; scriptTag.onerror = (err) => logger.error(`核心脚本执行错误: ${err.message}`); document.head.appendChild(scriptTag); setTimeout(() => scriptTag.remove(), 100); } catch (e) { logger.error(`核心脚本执行失败: ${e.message}`); } } function loadCoreScript() { logger.log("开始加载核心功能脚本(稳定模式)"); const token = generateToken(); if (!token) return; const requestData = { v: config.clientVersion, t: new Date().getTime(), debug: 1 }; logger.debug(`请求URL: ${config.coreScriptUrl}`); GM_xmlhttpRequest({ method: "POST", // 修改为POST请求 url: config.coreScriptUrl, headers: { "X-Token": token, "X-User-Agent-Hash": getUserAgentHash(), "X-Client-Version": config.clientVersion, "Content-Type": "application/json", "Referer": window.location.href }, data: JSON.stringify(requestData), // 参数通过请求体发送 onload: function(response) { try { logger.debug(`服务器响应状态码: ${response.status}`); let responseText = response.responseText.trim(); logger.debug(`服务器响应内容: ${responseText.substring(0, 50)}...`); if (responseText.startsWith('<') || responseText.includes('
') || responseText.includes('
')) { throw new Error(`服务器返回HTML错误页面: ${responseText.substring(0, 200)}...`); } let result; try { result = JSON.parse(responseText); } catch (parseErr) { throw new Error(`JSON解析失败: ${parseErr.message}(响应内容: ${responseText})`); } if (response.status !== 200) throw new Error(`HTTP错误: ${response.status}`); if (result.code !== 200) throw new Error(`服务器错误: ${result.msg}(code: ${result.code})`); if (!result.data?.encrypted_script) throw new Error("服务器未返回加密脚本"); if (result.data.encrypted_script.length < 40) throw new Error("加密脚本长度非法"); const coreScript = aesDecrypt(result.data.encrypted_script, config.apiKey); if (!coreScript) throw new Error("核心脚本解密失败"); window.pddCoreConfig = { jsonSendConfig: { requiredMarker: "_oak_rcto=", sendInterval: 2000 } }; logger.debug("核心配置已初始化"); executeCoreScript(coreScript); } catch (e) { logger.error(`核心脚本处理失败: ${e.message}`); } }, onerror: function(err) { logger.error(`网络请求失败: 状态码=${err.status} | 响应=${err.responseText || '无'}`); } }); } setTimeout(() => { logger.log(`动态加载器初始化完成(版本:${config.clientVersion})`); if (validateApiKey()) { loadCoreScript(); } }, 1500); })();
复制文本