ZSHExtension

一个简单的Chrome扩展,用于在所有页面插入一行代码。

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         ZSHExtension
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description  一个简单的Chrome扩展,用于在所有页面插入一行代码。
// @author       Your Name
// @match        *://*/*
// @license      MIT
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    function injectScript() {
        const scriptContent = `
            (function() {
                console.log("开始插入代码");
                function modifyFunction(func) {
                    return function(b, h) {
                        if (typeof b !== 'undefined' && b !== null) {
                            console.log("修改参数前 - 查看",b.securityCode);
                            b.securityCode = "";
                            console.log("插入的新代码 - b.securityCode 已修改");
                        } else {
                            console.log("b 对象未定义或为空");
                        }
                        // 原始函数的逻辑
                         b.securityCode = ""; // 新插入的代码
                        console.log("修改参数后 - 查看",b.securityCode);
                        var c = this.local.createUuid();
                        console.log("UUID 创建成功:", c);
                        var y = this.local.createUrl(c, b); 
                        console.log("URL 创建成功:", y);
                        y = this.local.createRequest(y, h);
                        console.log("Request 创建成功:", y);
                        this.rm[c] = y;
                        y.run();
                        console.log("Request 运行成功");
                    };
                }

                function waitForComSbpsSystem(retryCount = 0) {
                    const maxRetries = 50; // 设置最大重试次数
                    const retryInterval = 100; // 设置重试间隔时间
                    if (typeof com_sbps_system !== 'undefined' && typeof com_sbps_system.generateToken === 'function') {
                    console.log(com_sbps_system.generateToken)
                        com_sbps_system.generateToken = modifyFunction(com_sbps_system.generateToken);
                        console.log("目标函数已修改");
                    } else {
                        if (retryCount < maxRetries) {
                            console.log(\`目标函数未找到,重试中...(第 \${retryCount + 1} 次)\`);
                            setTimeout(() => waitForComSbpsSystem(retryCount + 1), retryInterval);
                        } else {
                            console.log("超过最大重试次数,停止重试");
                        }
                    }
                }
                console.log("页面已完全加载,开始检查目标函数");
                waitForComSbpsSystem();
            })();
        `;
        const script = document.createElement('script');
        script.textContent = scriptContent;
        document.documentElement.appendChild(script);
        script.remove();
    }
    console.log("Content script loaded");
    injectScript();
})();