朱雀大模型 / BadStudent 试用次数重置器

通过随机化指定网站 localStorage 中的特定键值(如 'fp', 'deviceId'),重置使用次数限制。

// ==UserScript==
// @name         朱雀大模型 / BadStudent 试用次数重置器
// @name:en      Zhuque AI Assistant / BadStudent Trial Count Resetter
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  通过随机化指定网站 localStorage 中的特定键值(如 'fp', 'deviceId'),重置使用次数限制。
// @description:en Resets usage limits for specified websites by randomizing specific keys (e.g., 'fp', 'deviceId') in localStorage.
// @author       Positionzer0
// @match        https://matrix.tencent.com/*
// @match        https://www.badstudent.ai/*
// @grant        none
// @run-at       document-start
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // --- 常量定义 ---
    const HEX_CHARACTERS = '0123456789abcdef';

    // --- 辅助函数 ---

    /**
     * 生成一个指定长度的随机十六进制字符串。
     * @param {number} length - 目标字符串的长度。
     * @returns {string} 生成的随机十六进制字符串。
     */
    function generateRandomHexString(length) {
        let result = '';
        for (let i = 0; i < length; i++) {
            const randomIndex = Math.floor(Math.random() * HEX_CHARACTERS.length);
            result += HEX_CHARACTERS.charAt(randomIndex);
        }
        return result;
    }

    /**
     * 生成一个 UUID v4 格式的字符串。
     * 格式: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
     * @returns {string} 生成的 UUID v4 字符串。
     */
    function generateUUIDv4() {
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
            const r = Math.random() * 16 | 0;
            const v = c === 'x' ? r : (r & 0x3 | 0x8); // 'y' 必须是 8, 9, a, or b
            return v.toString(16);
        });
    }

    /**
     * 在 localStorage 中设置新的值。
     * @param {string} key - localStorage 中的键名。
     * @param {string} value - 要设置的新值。
     * @param {string} siteName - 网站名称,用于日志记录。
     */
    function setNewLocalStorageValue(key, value, siteName) {
        try {
            localStorage.setItem(key, value);
            // console.log(`[${siteName} Reset Script] New value for '${key}': ${value}`);
        } catch (error) {
            console.error(`[${siteName} Reset Script] Error setting new value for '${key}' in localStorage:`, error);
        }
    }

    // --- 核心逻辑 ---

    /**
     * 根据当前网站应用相应的重置逻辑。
     */
    function applyResetLogic() {
        const hostname = window.location.hostname;

        if (hostname === 'matrix.tencent.com') {
            const FINGERPRINT_KEY = 'fp';
            const FINGERPRINT_LENGTH = 32;
            const newFingerprintValue = generateRandomHexString(FINGERPRINT_LENGTH);
            setNewLocalStorageValue(FINGERPRINT_KEY, newFingerprintValue, 'Zhuque');
        } else if (hostname === 'www.badstudent.ai') {
            const DEVICE_ID_KEY = 'deviceId';
            const newDeviceId = generateUUIDv4();
            setNewLocalStorageValue(DEVICE_ID_KEY, newDeviceId, 'BadStudentAI');
        }
    }

    // --- 执行 ---
    // 立即执行重置逻辑
    applyResetLogic();

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址