编辑代码


function decryptParamConsole(encryptedStr) {
    // 1. 提取加密部分(去除前缀 "datad-")
    const encryptedPart = encryptedStr.startsWith('datad-') ? encryptedStr.substring(6) : encryptedStr;

    // 2. AES 解密函数(ECB 模式 + PKCS7 填充)
    const key = CryptoJS.enc.Utf8.parse('4ad6949c413d4a58844a072d7f22313c');
    const base64Str = encryptedPart.replace(/-/g, '+').replace(/_/g, '/');
    const ciphertext = CryptoJS.enc.Base64.parse(base64Str);
    const decrypted = CryptoJS.AES.decrypt(
        { ciphertext: ciphertext },
        key,
        { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }
    );

    const decryptedBase64 = decrypted.toString(CryptoJS.enc.Utf8);

    // 3. Base64 解码
    let decodedStr;
    try {
        decodedStr = window.atob(decryptedBase64);
    } catch (e) {
        console.error("Base64 decode failed:", e);
        return encryptedStr;
    }

    // 4. URL 解码
    try {
        return decodeURIComponent(decodedStr);
    } catch (e) {
        console.error("URL decode failed:", e);
        return decodedStr;
    }
}
decryptParamConsole('datad-i7cQB2ZOa5Xw2DtD5F9dUECRaRRa2dlBOVpWRD_q9Qr4LQmwTTrRF-Umfk9GsSq2');